mysql_fetch_array
| From: | its me | Date: | Thu, 27 Sep 2001 20:46:04 +0000 |
| Subject: | mysql_fetch_array | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-12800@lists.php.net to get a copy of this message | ||
i have 2 tables:
printers,desktops
and both have a field called price(it was on purpose to have the same name)
here is the problem:
$result=mysql_query("select * from printers,desktops
where desktops.companyname='$valcompanyname'
and desktops.companyname=printers.companyname");
$num=mysql_num_rows($result);
$cur=0;
while($cur<$num)
{
$row=mysql_fetch_array($result);
echo $row["price"]."<BR>";
$cur++;
}
now i have the num =6(its correct i have 3 rows in printers table and 3 rows in desktops table that
meet the condition)
the problem is that this return only the 3 rows or price in desktops and repeat them again and
igonre rows in printers table
so!!!!!
------------------------------------------------------------
------------------------------------------------------------