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>"; 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 "; 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; 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. 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
Archived
This topic is now archived and is closed to further replies.