RE: [PHP] Not quite relevant question about coding and query

From: Date: Fri, 19 Jan 2001 06:11:33 +0000
Subject: RE: [PHP] Not quite relevant question about coding and query
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-35572@lists.php.net to get a copy of this message
>-----Original Message----- >From: Jason Murray [mailto:Jason.Murray@melbourneit.com.au] >Sent: Thursday, January 18, 2001 9:57 PM >To: 'Jacky@lilst'; php-general@lists.php.net >Subject: RE: [PHP] Not quite relevant question about coding and query > > >> $query = "insert into user values >('firstname','lastname','address','phone')"; >> $resultinsert = mysql_query($query); >> >> $getID = "select userID from user"; // Will this get me the >> // Id of the record I just inserted? >> $resultID = mysql_query($getID); > >No, it won't - it'll return every userID in the table. > >If your userIDs are sequential, you can just select "MAX(userID)" instead >of userID. > >Jason > >-- > Im no expert...I am learning this stuff "as we speak"....but shouldn't mysql_insert_id() do it? Cheers, Dave

« previous php.general (#35572) next »