Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Pagination for Splitting results from mysql

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #41520
    Al3ks
    Participant

    Hi everyone

    I need help with implementing a simple pagination feature to my own/custom website, and since I’m really confused I’ll explain from basics what I am trying to achieve.

    I have a simple table with 3 columns and 17 entries in my database. The results are returned in a HTML table, each entry in a separate row. Now I want to split the results to show only 5 entries per page.

    I have searched for various tutorials and codes which at the end got me confused and I’m stuck :(

    Anyone can help me to implement such feature in to my page, please?

    here is my code atm:

    mysql_connect (“localhost”,”***”,”***”) or die (‘Cannot connect to MySQL: ‘ . mysql_error());
    mysql_select_db (“***”) or die (‘Cannot connect to the database: ‘ . mysql_error());

    //query
    $query = mysql_query(“select title, description, image from jobs”) or die (‘Query is invalid: ‘ . mysql_error());

    //write the results
    while ($row = mysql_fetch_array($query)) {

    ?>

    #118551
    Al3ks
    Participant

    Thanks for the help, the results are now limited to 5 on the page.

    > Sorry — should have mentioned you will need to give links to the other pages.

    I have made a link like this following your examples

    < a href="">Next

    This goes to my main domain page plus /2 at the end. But page is not found (404).
    Where are the different pages defined?

    #118553
    Al3ks
    Participant

    Sorry I’m still a novice in this stuff.

    So I got the link like this, and it works:

    < a href="articles.php?page=">Next

    I hope that’s how it should be.

    Thanks for your help.

    Viewing 3 posts - 1 through 3 (of 3 total)
    • The forum ‘Back End’ is closed to new topics and replies.