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
Comments and replies About Query to get last row was inserted in a database table