RE: [PHP-DB] simple database question

2001-07-26 Thread Hoover, Josh
OK, you're using SQL Server, right? Try executing this statement after you insert the user and before you try inserting the address record: select @@identity That should give you the last inserted id, assuming it's an identity column. Josh Hoover KnowledgeStorm, Inc. [EMAIL PROTECTED] Searchi

RE: [PHP-DB] simple database question

2001-07-26 Thread Hoover, Josh
Hi Brian, Are you using MySQL? If so, you can use the function mysql_insert_id(). http://www.php.net/manual/en/function.mysql-insert-id.php That will give you the last id inserted by MySQL which you can use in the address table. Josh Hoover KnowledgeStorm, Inc. [EMAIL PROTECTED] Searching fo

RE: [PHP-DB] simple database question

2001-07-26 Thread Dave Watkinson
What I usually do is do a SELECT COUNT(user_primary_key_column_name) and count the number of rows - then I'll know what the last autonumber added was. A more accurate way is to do your INSERT statement, then follow it immediately with a SELECT select uid,name,address1,phone from users where name