Copy link to clipboard
Copied
i have two prices the price and a discount, some products have the discount a couple dont if they dont have the discount i want to have hide the price as below
<? if (!$row_rsProduct['Product'] == 'prod1'):
?>
<?php echo DoFormatCurrency($row_rsProduct['Price'], 2, '.', '.', '£ ', ''); ?>
<?php endif; ?>
<?php echo DoFormatCurrency($row_rsProduct['Discount'], 2, '.', '.', '£ ', ''); ?>
Is there a reason you are wrapping every line of code in script tags?
Is prod1 a variable, a costant, or a literal? If a variable, begin with a dollar sign. If a constant, make it all caps (that's for the sake of convention) and don't wrap in single quotes. If a literal, then leave the way you had it. I suspect you intended a variable.
if ($row_rsProduct['Product'] != $prod1){
echo DoFormatCurrency($row_rsProduct['Price'], 2, '.', '.', '£ ', '');
}
echo DoFormatCurrency($row_rsProduc
...Copy link to clipboard
Copied
Show us an example of the output you are getting and include the value of the 'Product' field.
'prod1' seems like a funny way to determine if a product has a discount.
Copy link to clipboard
Copied
Is there a reason you are wrapping every line of code in script tags?
Is prod1 a variable, a costant, or a literal? If a variable, begin with a dollar sign. If a constant, make it all caps (that's for the sake of convention) and don't wrap in single quotes. If a literal, then leave the way you had it. I suspect you intended a variable.
if ($row_rsProduct['Product'] != $prod1){
echo DoFormatCurrency($row_rsProduct['Price'], 2, '.', '.', '£ ', '');
}
echo DoFormatCurrency($row_rsProduct['Discount'], 2, '.', '.', '£ ', '');
Copy link to clipboard
Copied
here is where all the code, a variable was not intented, it is an actual product name that needs to be used
$var1_rsProduct = "-1";
if (isset($_GET['productID'])) {
$var1_rsProduct = $_GET['productID'];
}
mysql_select_db($database_event, $event);
$query_rsProduct = sprintf("SELECT * FROM eventAW13_Cat, eventAW13_products, eventAW13_Stock, eventAW13_SizeList WHERE eventAW13_products.catID = eventAW13_Cat.catID AND eventAW13_products.ProductID = eventAW13_Stock.ProductID AND eventAW13_Stock.SizeID = eventAW13_SizeList.SizeID AND eventAW13_products.ProductID = %s AND eventAW13_Stock.Stock != 0 ORDER BY eventAW13_Stock.StockID", GetSQLValueString($var1_rsProduct, "int"));
$rsProduct = mysql_query($query_rsProduct, $event) or die(mysql_error());
$row_rsProduct = mysql_fetch_assoc($rsProduct);
$totalRows_rsProduct = mysql_num_rows($rsProduct);
the actual product is "jumper red stripe"
><? if (!$row_rsProduct['Product'] == 'jumper red stripe'):
?><?php echo DoFormatCurrency($row_rsProduct['Price'], 2, '.', '.', '£ ', ''); ?><?php endif; ?><?php echo DoFormatCurrency($row_rsProduct['Discount'], 2, '.', '.', '£ ', ''); ?>
in the database i have two columns the "Discount and the "Price" if something does not have a discount they have the same price in both so only need the discount one showing thus hide the "Price".
Copy link to clipboard
Copied
I'll repeat my question from earlier:
"Show us an example of the output you are getting and include the value of the 'Product' field."
You haven't explained to us how this code is misbehaving. What's it doing?
Like Rob, I also don't understand why you are wrapping each line in script tags.
Copy link to clipboard
Copied
Bregent,
I'm pretty sure I pointed him in the right direction. The condition of his if statement was wrong. He needs to make a little effort to look at the code I provided.
Copy link to clipboard
Copied
sorry, your correct i didnt read the code you posted well enough, i put the exclamation mark in the wrong place and there is no reason for the extra script tags. i am cleaning my code up
thank you both for the help
Copy link to clipboard
Copied
Glad you got it sorted out.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more