Forum Moderators: coopster

Message Too Old, No Replies

php mysql

find if last query was processed or not

         

ayushchd

7:02 pm on Sep 1, 2010 (gmt 0)

10+ Year Member



Hi,

I have code where I insert some records then use the id of that record to insert into some other table. It works fine. But I want to know if there is some way I can find out if the last query has been processed or is still being processed before I move onto the second line. Here is the relevant part of the code..

$DBConnection->InsertRecord('afq_question', $insertArray);
//here i want to check if the last query has been processed or not..
$qid = $DBConnection->GetFirstData("SELECT id FROM afq_question WHERE qid=$x[quizid] AND question='$q'");

will using mysql_insert_id() solve this?

Thanks

Anyango

5:11 am on Sep 2, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Maybe i dont know enough but i believe that on that single connection your next line will automatically have to wait for execution till the time 1st execution isnt complete. That query must be executed before control moves on to your next line, or do you mean to say if it has been executed successfuly and a record was created ? yes mysql_insert_id will do then