A somewhat complicated problem

admin

Administrator
Staff member
The following code is supposed to grab the primary key from the last insert, and insert it into the table 'request'. It is grabbing some ID, but it is always one ahead. For example, if the last primary key was '1', it would show up as '2' in the request table...'2' would be '3', and so forth. How can I get the two to equal one another?

Thanx

$NewID=mysql_insert_id

$query="INSERT INTO request VALUES(NULL, NULL, '$request','$type',1,'$NewID')";
mysql_query($query) or DIE("Insert failed!");
 
Back
Top