There is no last row by default. You need to order the table by some field.
The best way is to make sure the row you want is the FIRST in the result.
Then you can have a query:
<?php select * from table .... order by ID desc.... LIMIT 1 ?>
I guess there is no problem to send the query, when you have it, from a PHP program.
If you want to select the last row of a table in PHP, follow this example code.
<?php include 'dbconnect.php'; // connect your database page $select_query = mysqli_query($con,"SELECT user_id FROM my_table_name ORDER BY id DESC LIMIT 1"); $row = mysqli_fetch_assoc($select_query); echo $row['user_id']; ?>
I hope it will be helpful for you. thanks for ask here.
Question and answer is powered by AnsPress.io