Jump to content

Need help to create dynamic php next content page.


Go to solution Solved by ginerjm,

Recommended Posts

I have created a script that orders post form mysql database.i have used

SELECT*From $tbl_name ORDER BY id DESC LIMIT 20

so,my page is showing only 20posts.but in next page i don't want to write the code manually.so help me with this one.i want the next content page to be created automatically & it will only hold 20post.

The word you're looking for is pagination. Your SQL queries will look like

SELECT * FROM $tbl_name ORDER BY id DESC LIMIT $offset, 20
and $offset = ($page - 1) * 20 (assuming the first page is $page=1).

Sounds more like you are new to programming in general as well as user forums.

 

This forum is here to help people with their code - not to just hand out snippets of code to solve your problems. When you decide to settle down and teach yourself some stuff and can give us your attempt at a script, then you can ask for help with it.

  • Solution

Glad we could get you on the right track. Learning how to program is not just copying someone else's hard work. It's about learning which involves reading and understanding and practice. Kind of like everything in this world.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.