On 15-May-01 William Poarch wrote:
> Hi all,
> 
> I have a setup where I populate one table as a temporary holding place for
> data. When the user's session is complete, I want to transfer all that data
> to a similar, permanent table.
> 
> The strangeness is this - most of the time the data is all transferred fine,
> but sometimes only a few of the records will make it. If it always failed,
> I'd just figure the code was wonky, but becuase it gets through
> sporadically, I'm stumped. I'm guessing it has something to do with one
> mysql_query starting up before the previous one is finished. Help, please.
> 
> Here's the code:
> 
> for($counter = 1; $counter <=20; $counter++)
> {
> if($carray[$counter] != "" && $carray[$counter] != "0")
> {
> $sql = "SELECT * FROM feedback_results_temp where about_user_pkey =
> '$aboutradio' and by_user_pkey = '$user_pkeytemp' and competency_pkey =
> '$carray[$counter]'";
> $result = mysql_query($sql);
> 
> $num = mysql_numrows($result);
> if ($num != "0") 
> {
> $row=mysql_fetch_object($result);
> $competency_pkey = $row->competency_pkey;
> $rating = $row->rating;
> $notes = $row->notes;
> 
> $sql_insert = "INSERT INTO feedback_results (about_user_pkey, by_user_pkey,
> competency_pkey, rating, date, notes) VALUES ('$aboutradio',
> '$user_pkeytemp', '$competency_pkey', '$rating', '$todaysdate', '$notes')";
> $result_insert = mysql_query($sql_insert);
> }
> }
> }
> 
> (After this, the code erases everything from feedback_results_temp)

Why the SQL -> PHP -> SQL jitterbug ?

$qry="INSERT INTO feedback_results (about_user_pkey,...  )
  SELECT about_user_pkey,by_user_pkey ...
  FROM feedback_results_temp 
  WHERE about_user_pkey = '$aboutradio' AND ...";
$res=mysql_query($qry);

Regards,
-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to