RE: [PHP-DB] Help with loop
| From: | Mark Newnham | Date: | Thu, 25 Jan 2001 19:41:10 +0000 |
| Subject: | RE: [PHP-DB] Help with loop | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-6172@lists.php.net to get a copy of this message | ||
$res = mysql_query("SELECT * FROM ecomm where ID ='$sid'",$db))
if(!$res){echo("error preforming query: " . mysql_error());exit();}
//----error trap
while( $row=mysql_fetch_array($res)){
$pno=$row["part"];
#####################################################
Mark Newnham
Application Design Associates, Inc
6021 S.Syracuse Way #302
Englewood, CO 80111, USA
http://www.adacorp.com
#####################################################
> -----Original Message-----
> From: Robert [mailto:rarg@bruinel.com]
> Sent: Thursday, January 25, 2001 12:31 PM
> To: php-db@lists.php.net
> Subject: [PHP-DB] Help with loop
>
>
> Why does this spit out the same part over and over until it times out?
>
> I have 2 tables in the same database
>
> 1: bruindba <-------Parts database
> specific_p <----Part Number
> manufactur <---Manufacturer
> package <---Package in
>
> 2: ecomm <-------Ecommerce database
> ID <-------session ID random number generated
> when first part is entered
> part <-------Part number
>
> What I am trying to do is store the part numbers with the
> session ID in ecomm and then pull all of them
> out with descriptions from bruindba.
>
> //----------------------------- Get parts for this session
> ------------------------
> //-------------------- Check ecomm DB for parts by session ID
> -------------------
> while ($res = mysql_query("SELECT * FROM ecomm where ID
> ='$sid'",$db)){
> if(!$res){echo("error preforming query: " .
> mysql_error());exit();} //----error trap
> $row=mysql_fetch_array($res);
> $pno=$row["part"];
>
> //---------------------Get part info from bruindba
> -----------------------
> $result = mysql_query("SELECT * FROM bruindba where
> specific_p ='$pno'",$db);
> if(!$result){echo("error preforming query: " .
> mysql_error());exit();} //----error trap
> $row=mysql_fetch_array($result);
> $spp=$row["specific_p"];
> $mfc=$row["manufactur"];
> $pkg=$row["package"];
> echo" $spp";
> echo" $pkg";
> echo" $mfc";
> }
>
>
> Thanks for any help you can provide -Bob-
>
>