- Forums
- MySQL
- Query To Get Last Row Was Inserted In A Database Table
This Page Contains information about Query To Get Last Row Was Inserted In A Database Table By wallpaperama in category MySQL with 0 Replies. [907], Last Updated: Sat May 18, 2024
wallpaperama
Tue Oct 14, 2008
0 Comments
1810 Visits
one of the most useful queries in mysql with php is when you wan tto query a row in your mysql database which is the last row or the last entry you just entered in a database table. well this is how you do it:
$sql = "SELECT this FROM table WHRE this=this ORDER BY userid DESC LIMIT 1";
the key is the ORDER DESC part of the query