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)