|
I want do calculate the downcout in % in price between two prices ("fyrrpris" and "nupris") - then i want it do be sorted so that the largest downcut in % is first on the list.
Have made the calculation in the querry, but it will not work.... probably the syntax....
$weather2 = mysql_db_query("$datab", "select id, lutnavn, lysing, fyrrpris, nupris, mynd, firmaid, bolkid, timestamp, ip, active from tilbud where active=1 and bolkid=$bolkur order by ((fyrrpris-nupris)/fyrrpris)*100 DESC");;
while ($row = mysql_fetch_array ($weather2))
{
$id = "".$row["id"];
$lutnavn = "".$row["lutnavn"];
$lysing = "".$row["lysing"];
$fyrrpris = "".$row["fyrrpris"];
$nupris = "".$row["nupris"];
$mynd = "".$row["mynd"];
$firmaid = "".$row["firmaid"];
$bolkid = "".$row["bolkid"];
$timestamp = "".$row["timestamp"];
$ip = "".$row["ip"];
$active = "".$row["active"];
$sparing = (($fyrrpris-$nupris)/$fyrrpris)*100;
}
}
I get this message when that runs:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /usr/home/web/xxxxxxxx/xxxxxxx/tilbudviewlist.php on line 10
Last edited by tomcat_fo; 10-04-2006 at 11:28 AM..
|