Re: mysql_fetch_array

From: Date: Thu, 27 Sep 2001 21:10:07 +0000
Subject: Re: mysql_fetch_array
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-12802@lists.php.net to get a copy of this message
hi i hope i understand u correctly... try this: <?php $result = mysql_query("select * from printers,desktops where desktops.companyname='$valcompanyname' and desktops.companyname=printers.companyname"); while($row = mysql_fetch_array($result)) { echo $row["price"]."<BR>\n"; } ?> Best regards Attila Strauss > 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!!!!! > > > > ------------------------------------------------------------ > ------------------------------------------------------------ > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#12802) next »