Rod Person wrote: > On Fri, 16 Mar 2007 22:28:54 -0500 > "Jeff" <[EMAIL PROTECTED]> wrote: > >> Is there a way to get the last Record # created by the DB. >> > >> >> $query = "INSERT INTO `t_users` (`user_id`, `f_name`, `l_name`, >> `e_mail`, `b_date`, `pic`) VALUES ('', '$f_name', '$l_name', >> '$e_mail', '$b_date', '')"; >> $result = mysql_query($query); >> if(!$result) >> { >> die("Could not query the database: <br/>".mysql_error()); >> } >> echo "Your Player information has been stored OK.<br />"; >> >> what code could I add here to make the following line work? >> >> echo "REMEMBER your USER ID# you will need it when creating >> Characters!! It is: $user_id"; <----- I want to >> show the "user_id" >> just created here. >> >> Thanks in advance! >> > > select user_id from t_users where user_id = (select max(user_id) from > t_users) >
It should be noted that that is the absolute 100% WRONG way to do it. If your site has any concurrency, you will almost certainly get the wrong user. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php