i'm guessing you use mysql, so... you can use the mysql_insert_id to retrieve the most recent addition, then select on it
$newid=mysql_insert_id(); $sql=select [the auto_increment field] from table1 where id='$newid'; Does that help? Morten Nielsen wrote: > Hi, > I got the following insert statement in my PHP code: > > $qid = db_query(" > INSERT INTO table1 ( > Name > ) VALUES ( > '$frm[Name]' > )"); > > This is working like I want it to. But in the table there is a column, which > is AUTO_INCREMENT. I would like to retreive this number right after I added > the data. > Can anybody help me? > > Thanks, > Morten -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php