I am trying to select the last record from a table in MySQL using PHP. I believe I have an SQL error. Here is my SQL code:
SELECT TOP 1 id FROM `table` ORDER BY id DESC
If this is valid and I actually have a PHP error, tell me.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
you have an invalid sql syntax. use LIMIT instead
try this:
the
TOPclause works on MSSQL server.