mysql> desc threads; +-------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+--------------+------+-----+---------+----------------+ | thread_ID | int(11) | | PRI | NULL | auto_increment | | subject | varchar(255) | YES | | NULL | | | author | varchar(30) | YES | | NULL | | | last_by | varchar(30) | YES | | NULL | | | views | int(11) | | | 0 | | | date_posted | datetime | YES | | NULL | | +-------------+--------------+------+-----+---------+----------------+ 6 rows in set (0.00 sec)
$SQL_insert_thread = "INSERT into threads "; $SQL_insert_thread .= "(subject, author, last_by, views, "; $SQL_insert_thread .= "date_posted) " values "; $SQL_insert_thread .= "(\'some_subject\', \'test_username\', $SQL_insert_thread .= "\'test_username\', 1, now())"; In the table threads above, I do have a field: "thread_ID" with auto_increment value. My question is can I obtain the value thread_ID while I do the insert statement just by 1 mySQL statement? If yes, please can somebody give me a sample code? Son Nguyen __________________________________________________ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php