neilmurray
Technical User
Hi I have the following snippet of code from a bigger programme.
while ( $row = mysql_fetch_array($result))
{
extract($row);
$l++;
$offerpricecom[$i][$l]=$offerprice;
echo $offerpricecom[$i][$l]; // line 1
}
for ($l==1;$l<=3;$l++)
{ $newprice=$offerpricecom[$i][$l];
echo "$newprice"; //line 2
$query = "select sum(offernumber) from offers where offerprice='$newprice'";
$result = mysql_query($query) or die ("Couldn't execute query2");
while ( $row = mysql_fetch_array($result))
{
echo "$row[0]";
//$num1=$offernumber;
//echo "$num1";
}
}
the code is echoing the correct number for $offerpricecom[$i][$l] on line 1 but then does not echo a number for $newprice on line 2 and hence does not do the query correctly.
What am I not understanding about using arrays?
Thanks,
Neil.
while ( $row = mysql_fetch_array($result))
{
extract($row);
$l++;
$offerpricecom[$i][$l]=$offerprice;
echo $offerpricecom[$i][$l]; // line 1
}
for ($l==1;$l<=3;$l++)
{ $newprice=$offerpricecom[$i][$l];
echo "$newprice"; //line 2
$query = "select sum(offernumber) from offers where offerprice='$newprice'";
$result = mysql_query($query) or die ("Couldn't execute query2");
while ( $row = mysql_fetch_array($result))
{
echo "$row[0]";
//$num1=$offernumber;
//echo "$num1";
}
}
the code is echoing the correct number for $offerpricecom[$i][$l] on line 1 but then does not echo a number for $newprice on line 2 and hence does not do the query correctly.
What am I not understanding about using arrays?
Thanks,
Neil.