I have a databse in mysql and am looking to select the last 5 values in the database and there contence. How would i do this.
Will be using php to do this.
Thanks
There is an incramenting variable called Id and could use that if possible.
I have a databse in mysql and am looking to select the last 5 values in the database and there contence. How would i do this.
Will be using php to do this.
Thanks
There is an incramenting variable called Id and could use that if possible.
I think this will work. I'm not positive if TOP is in MySQL.
SELECT TOP 5 *
FROM table
ORDER BY id DESC
(assuming 'id' is the primary key in the table)
you might also want to put LIMIT 5 on there at the very end to just retrieve the last 5 results
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.