project3 Posted January 12, 2008 Share Posted January 12, 2008 I am trying to get this done in one query. I want to return the results and not just last inserted id. see in my code below i get the last id just fine but I want to get all the other Fields too not just the id. is there a way i can do this? $query = "SELECT LAST_INSERT_ID() from members"; $result = mysql_query($query); if ($result) { $nrows = mysql_num_rows($result); $row = mysql_fetch_row($result); $lastID = $row[0]; echo "<br><br>$lastID<br><br>"; Quote Link to comment https://forums.phpfreaks.com/topic/85719-solved-return-previously-entered-result/ Share on other sites More sharing options...
thomashw Posted January 12, 2008 Share Posted January 12, 2008 $query = "SELECT * from members"; $result = mysql_query($query); if ($result) { $row = mysql_fetch_row($result); $lastID = $row[0]; echo " $lastID "; Quote Link to comment https://forums.phpfreaks.com/topic/85719-solved-return-previously-entered-result/#findComment-437472 Share on other sites More sharing options...
revraz Posted January 12, 2008 Share Posted January 12, 2008 What about SELECT * FROM members ORDER BY id DESC LIMIT 1; Quote Link to comment https://forums.phpfreaks.com/topic/85719-solved-return-previously-entered-result/#findComment-437473 Share on other sites More sharing options...
project3 Posted January 12, 2008 Author Share Posted January 12, 2008 yeah that would work ok. thanks. Quote Link to comment https://forums.phpfreaks.com/topic/85719-solved-return-previously-entered-result/#findComment-437474 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.