...

View Full Version : id problem



zodehala
02-01-2012, 05:36 PM
table_user
-----------------
userid | username

table_ad
----------------
adid | userid | ad

after i insert record into table_user i will insert userid coming from table_user into table_ad .

but how ?

Fou-Lu
02-01-2012, 08:15 PM
What is userid? If its an auto increment you can fetch the last insert using either SQL's LAST_INSERT_ID() or using PHP's mysql_insert_id (assuming MySQL, most others have a similar). That can then be used to insert where necessary.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum