What I am trying to do is multiple the variable $price with two other variables $markup and $exchange.
The data for markup and exchange is in a different table "pricing" and $price comes from "products".
I have been playing around with it for a while but can't figure out how to muliple the data in "pricing" with the variable $price.
In the "pricing" table, there is only 1 record with the "markup" and "exchange" data.
Can someone help me alter the below code to do what I want to do.
Ideally, after this line:
$price=mysql_result($resultall,$x,"price"
I would like to have something like:
$price = $price $markup $exchange
But I am not sure how to get to that point, everything i've tried has resulted in errors or it displaying "0".
Here is the current code I have:
<?
include("datacon.php");
?>
<?
if ($sortby!="")
{
$sorted = " order by $sortby ";
}
$bareQuery = "select part,price from products where company = 'onderground'";
$queryall = $bareQuery.$sorted;
$resultall = MYSQL_QUERY($queryall);
$numberall = mysql_Numrows($resultall);
if ($numberall==0) {
echo "No Records Found !";
}
else if ($numberall>0) {
$x=0;
?>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td bgcolor="#000080">
<font face="Verdana" size="2"><b><a href="<? echo $PHP_SELF; ?>?sortby=part">Part</a></b></font></td>
<td bgcolor="#000080" align="center">
<font face="Verdana" size="2"><b><a href="<? echo $PHP_SELF; ?>?sortby=price">CDN Price</a></b></font></td>
<td bgcolor="#000080" align="center"><b><font face="Verdana" size="2">Buy Online</font></b></td>
</tr>
<?
while ($x<$numberall)
{
// Changing Background color for each alternate row
if (($x%2)==0) { $bgcolor="#OOOOOO"; } else { $bgcolor="#OOOOOO"; }
// Retreiving data and putting it in local variables for each row
$part=mysql_result($resultall,$x,"part");
$price=mysql_result($resultall,$x,"price");
?>
<tr bgcolor="<? echo $bgcolor; ?>">
<td valign="top"><font face="Verdana" size="2"> <? echo $part; ?> </font></td>
<td align="center" valign="top"><font face="Verdana" size="2"> <? echo $price; ?> </font></td>
<td align="center"><font face="Verdana" size="2"><a href="ordering.htm">buy</a></font></td>
</tr>
<?
$x++;
} // end while
?>
</table>
<?
} // end if numberall > 0
?>