Page 1 of 1

Displaying a sale price if something is on sale...

Posted: Thu Oct 28, 2004 8:30 pm
by zander213
Hi - I am designing my first php page and I have 2 colums for price, one for "price" and one for "saleprice"... as well as a column that tells me if an item is on sale "Y" or "N"...

Can someone help me write a simple script to display the "saleprice" and not the "price" if sale = Y...

I know it's really simple, but I am still a noobie, and need a little help. Here is my script for displaying the regular price:

<?php echo $row_shoes['price']; ?>

Any help would be GREATLY appreciated!

Thanks!

Posted: Fri Oct 29, 2004 2:54 am
by phpScott
your a third of the way there.

Code: Select all

<?php
if($row_shoes['onSale']=='Y')
  echo $row_shoes['salePrice'];
else
  echo $row_shoes['price'];
?>
of course I have made a few assumptions but you should get the general idea.