Re: Retreiving data from a table

From: Date: Sat, 02 Mar 2002 00:10:52 +0000
Subject: Re: Retreiving data from a table
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-17404@lists.php.net to get a copy of this message
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

« previous php.db (#17404) next »