Results 1 to 2 of 2

Thread: displaying by username

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2020
    Posts
    4

    displaying by username

    hello

    im using this to display my records in a table with pagination but it will show all the records but i want it do it only shows the records that the username put in to the database i tried this.

    below shows all the records

    PHP Code:
    $sql 'SELECT * FROM orders LIMIT '.$page1.', 4'
    this is ment to just show the records off the person logged in but seems to get an error.

    CODE: SELECT ALL
    PHP Code:
    $sql 'SELECT * FROM orders  WHERE OrderBy = '$username'LIMIT '.$page1.', 4'

  2. #2

    Re: displaying by username

    Hello Markob,

    Try this code...

    Code:
    <?php
    if (isset($_GET["page"])) { $page  = $_GET["page"]; } else { $page=1; }; 
    $start_from = ($page-1) * $results_per_page;
    $sql = "SELECT * FROM ".$datatable." ORDER BY ID ASC LIMIT $start_from, ".$results_per_page;
    $rs_result = $conn->query($sql); 
    ?>
    For more Clarification refer this site https://www.phpjabbers.com/php--mysq...ges-php25.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width