Hey everyone;
I have an insert statement that (obviously) has an AI value in the row. What I need to do is 'grab' that value and (possibly?) store that in a variable to be re-used in the next concurrent insert statement.
Basically it looks like this:
$query = select t1.col1,t1.col2,t2.col3 from table1 t1,table2 t2
where {conditions where};
while($rows = $arry_func($query)){ $col1 = $rows['col1'] etc.}
$insert = insert into table3 (col1,col2,col3) VALUES ('AI','','');
[COLOR="Red"]$insert2 = insert into table4 (col1,col2,col3) VALUES ('$AI','','');
[/COLOR]
In that example i need to carry the same AI value over. What is the best method here? I have tried:
$AI_VALUE = mysql_insert_id($insert);
However, using it like that its out of scope for the next loop I suppose as the value is NULL.
I am probably making this harder than it needs to be. TIA for any help you might have!