Re: mysql_fetch_array
| From: | Peter Gibson | Date: | Thu, 27 Sep 2001 20:47:43 +0000 |
| Subject: | Re: mysql_fetch_array | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-12801@lists.php.net to get a copy of this message | ||
Use need to use "select as" (see manual) beacause two fields cannot have the
same name in a recordset...
(u need to use aliases)
----- Original Message -----
From: "its me" <fotna@egypt.net>
To: <php-db@lists.php.net>
Sent: Thursday, September 27, 2001 9:46 PM
Subject: [PHP-DB] mysql_fetch_array
> 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
>
>