php blog - mysql select problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kozmk
Forum Newbie
Posts: 2
Joined: Sat May 03, 2008 6:19 am

php blog - mysql select problem

Post by kozmk »

hey guys,

I'm trying to script my own blog, but I have a problem.
On the homepage I got the script to show the last 5 post that have been made, but now I want to show "older" post so it I need a page that skips the first 5 post and shows the next 5 post. How can I get this info out of mysql ?


thanks
matthewl
Forum Newbie
Posts: 13
Joined: Sat May 03, 2008 5:28 am

Re: php blog - mysql select problem

Post by matthewl »

at the moment i assume that you are using LIMIT 5 at the end of your sql query.

LIMIT can also take the offset so LIMIT 5,5 will give you records 6-10
kozmk
Forum Newbie
Posts: 2
Joined: Sat May 03, 2008 6:19 am

Re: php blog - mysql select problem

Post by kozmk »

ah no , I was using another system, gone try that out :) thanks alot m8
matthewl
Forum Newbie
Posts: 13
Joined: Sat May 03, 2008 5:28 am

Re: php blog - mysql select problem

Post by matthewl »

When your dealing with mysql, you will find that a lot of things mysql is quicker at doing than php, so its always worth checking to see if mysql can do something before you do it in php. Sorting, limiting, joining tables will always be quicker in mysql.
Post Reply