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-    
     

Reply via email to