not so much in one step, but once you have inserted it you can call the
function

mysql_insert_id();

and it will return the auto_increment value of the last insert operation.

see the manual for more.

HTH
Beau

// -----Original Message-----
// From: Scott Mebberson [mailto:[EMAIL PROTECTED]]
// Sent: Thursday, 9 August 2001 8:49 AM
// To: [EMAIL PROTECTED]
// Subject: [PHP-DB] Inseting info into MySQL and retrieving 
// all in one SQL
// command
// 
// 
// Hi guys,
// 
// I am adding some information to my MySQL database. It is 
// user's information.
// So it has things like email address, password, username, all 
// that sort of
// stuff.
// 
// What I need to do is once I have added it found out the id - 
// a primary key
// which auto increments itself. At the moment I am doing two 
// different MySQL
// queries an INSERT and a SELECT to first of all add the 
// information and then
// find out the primary key.
// 
// Is there anyway I can do this in one step?
// 
// Thanks in advance
// 
// Scott Mebberson
// [EMAIL PROTECTED]
// 
// 
// 
// -- 
// PHP Database Mailing List (http://www.php.net/)
// To unsubscribe, e-mail: [EMAIL PROTECTED]
// For additional commands, e-mail: [EMAIL PROTECTED]
// To contact the list administrators, e-mail: 
// [EMAIL PROTECTED]
// 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to