Jump to content

Insert into auto increment and remember the value?


joe92

Recommended Posts

An admin of a site I am creating needs to be able to create members with certain extra authorities, moderators if you will. They will create the members and insert all the details. However, they also need to keep paper records of these moderators with all the details on them. On these paper records is included the ID of the moderator. So I wish to display on screen after the member has been created, the members ID so the admin can make a note of it.

 

This is the query being used (shortened):

$new = mysql_query("INSERT INTO members (ID, name) VALUES (NULL, '$name')");

 

Without again querying the database am I able to find out what the value of the newly created ID is, that NULL value? Google has revealed nothing so far.

 

Thanks for any help,

Joe

ok, you don't insert anything into an auto inc filed - EVER.  You can't retrieve a resultset from running an INPUT statement.  If you want information out of the database you are going to need to run a SELECT on it, so you will need another query.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.