I am trying to insert an auto_increment value into multiple tables but its seems to lose its value after the the second insert statement and my code is as follows can any1 please help. The auto_increment value that i want to use is the one from the client table and it will insert in the CONTACTS table but it will not in the JOBSHEET and KNOWLEDGE table. last_insert_id( ) has not worked because i have auto increment fields in all the tables pliz pliz help
mysql_query("IN SERT INTO CLIENT VALUES(
NULL, '$companyname', '$contactname', '$siteaddress', '$phonenumber', NULL, '$website', '$code', '$postaladdress ')") or die (mysql_error()) ;
mysql_query('SE T @clientID = last_insert_id( )') or die (mysql_error()) ;
mysql_query("IN SERT INTO CONTACTS VALUES( NULL, '@clientID' )") or die (mysql_error()) ;
mysql_query("IN SERT INTO JOBSHEET VALUES( NULL, '@clientID')") or die (mysql_error()) ;
mysql_query("IN SERT INTO KNOWLEDGE VALUES( NULL, '@clientID', '$categoryID', '$staffID', '$knowledge')") or die (mysql_error()) ;
mysql_query("IN SERT INTO CLIENT VALUES(
NULL, '$companyname', '$contactname', '$siteaddress', '$phonenumber', NULL, '$website', '$code', '$postaladdress ')") or die (mysql_error()) ;
mysql_query('SE T @clientID = last_insert_id( )') or die (mysql_error()) ;
mysql_query("IN SERT INTO CONTACTS VALUES( NULL, '@clientID' )") or die (mysql_error()) ;
mysql_query("IN SERT INTO JOBSHEET VALUES( NULL, '@clientID')") or die (mysql_error()) ;
mysql_query("IN SERT INTO KNOWLEDGE VALUES( NULL, '@clientID', '$categoryID', '$staffID', '$knowledge')") or die (mysql_error()) ;
Comment