Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2008
    Posts
    80
    Rep Power
    0

    Pagination Not Showing Page2


    Hello guys,

    For a very long time i've trying to battle this but to no avail.
    my pagination works fine. the problem is that should i use it on a search page,
    it shows only the first page and the other pages empty


    PHP Code:
    <?php
    $agent
    $_GET['id'];
    $stmt $pdo->prepare("SELECT surname, firstname FROM confirmed WHERE username = '$agent'");
    $stmt->execute();
    $row $stmt->fetch(PDO::FETCH_ASSOC);
    $_SESSION['ref_agent'] = $row['surname'] . " "$row['firstname'];
     
     
    error_reporting(E_ALL & ~E_NOTICE);
        
    /*
            Place code to connect to your DB here.
        */
        // include your code to connect to DB.

        
    $tbl_name="processed";        //your table name
        // How many adjacent pages should be shown on each side?
        
    $adjacents 5;
        
        
    /*
           First get total number of rows in data table.
           If you have a WHERE clause in your query, make sure you mirror it here.
        */
        
        
    $stmt $pdo->prepare("SELECT COUNT(*) as num FROM $tbl_name WHERE invitee = '$agent'");
        
    $stmt->execute();
        
    $total_pages $stmt->fetch(PDO::FETCH_ASSOC);
        
    $total_pages $total_pages['num'];
        
        
    /* Setup vars for query. */
        
    $targetpage "view-commission.php";     //your file name  (the name of this file)
        
    $limit 3;                                 //how many items to show per page
        
    $page $_GET['page'];
        if(
    $page)
            
    $start = ($page 1) * $limit;             //first item to display on this page
        
    else
            
    $start 0;                                //if no page var is given, set start to 0
        
        /* Get data. */
        
        
    $stmt $pdo->prepare("SELECT * FROM $tbl_name WHERE invitee = '$agent' ORDER BY date_processed DESC LIMIT $start$limit");
        
    $stmt->execute();
        
    //$num_rows = $stmt->rowCount();
        //print "<p>$num_rows Record(s) Found.</p>";
        
        /* Setup page vars for display. */
        
    if ($page == 0$page 1;                    //if no page var is given, default to 1.
        
    $prev $page 1;                            //previous page is page - 1
        
    $next $page 1;                            //next page is page + 1
        
    $lastpage ceil($total_pages/$limit);        //lastpage is = total pages / items per page, rounded up.
        
    $lpm1 $lastpage 1;                        //last page minus 1
        
        /*
            Now we apply our rules and draw the pagination object.
            We're actually saving the code to a variable in case we want to draw it more than once.
        */
        
    $pagination "";
        if(
    $lastpage 1)
        {    
            
    $pagination .= "<div class=\"pagination\">";
            
    //previous button
            
    if ($page 1)
                
    $pagination.= "<a href=\"$targetpage?page=$prev\"> previous</a>";
            else
                
    $pagination.= "<span class=\"disabled\"> previous</span>";    
            
            
    //pages    
            
    if ($lastpage + ($adjacents 2))    //not enough pages to bother breaking it up
            
    {    
                for (
    $counter 1$counter <= $lastpage$counter++)
                {
                    if (
    $counter == $page)
                        
    $pagination.= "<span class=\"current\">$counter</span>";
                    else
                        
    $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";                    
                }
            }
            elseif(
    $lastpage + ($adjacents 2))    //enough pages to hide some
            
    {
                
    //close to beginning; only hide later pages
                
    if($page + ($adjacents 2))        
                {
                    for (
    $counter 1$counter + ($adjacents 2); $counter++)
                    {
                        if (
    $counter == $page)
                            
    $pagination.= "<span class=\"current\">$counter</span>";
                        else
                            
    $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";                    
                    }
                    
    $pagination.= "...";
                    
    $pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>";
                    
    $pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>";        
                }
                
    //in middle; hide some front and some back
                
    elseif($lastpage - ($adjacents 2) > $page && $page > ($adjacents 2))
                {
                    
    $pagination.= "<a href=\"$targetpage?page=1\">1</a>";
                    
    $pagination.= "<a href=\"$targetpage?page=2\">2</a>";
                    
    $pagination.= "...";
                    for (
    $counter $page $adjacents$counter <= $page $adjacents$counter++)
                    {
                        if (
    $counter == $page)
                            
    $pagination.= "<span class=\"current\">$counter</span>";
                        else
                            
    $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";                    
                    }
                    
    $pagination.= "...";
                    
    $pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>";
                    
    $pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>";        
                }
                
    //close to end; only hide early pages
                
    else
                {
                    
    $pagination.= "<a href=\"$targetpage?page=1\">1</a>";
                    
    $pagination.= "<a href=\"$targetpage?page=2\">2</a>";
                    
    $pagination.= "...";
                    for (
    $counter $lastpage - (+ ($adjacents 2)); $counter <= $lastpage$counter++)
                    {
                        if (
    $counter == $page)
                            
    $pagination.= "<span class=\"current\">$counter</span>";
                        else
                            
    $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>";                    

                    }
                }
            }
            
            
    //next button
            
    if ($page $counter 1)
                
    $pagination.= "<a href=\"$targetpage?page=$next\">next </a>";
            else
                
    $pagination.= "<span class=\"disabled\">next </span>";
            
    $pagination.= "</div>\n";        
        }
     
     
    echo 
    "<table width='100%' class='table table-striped'>";
    echo 
    "<tr>
        <th bgcolor='#444444' align='center'><font color='#fff'> one</th>
        <th bgcolor='#444444' align='center'><font color='#fff'> two</font></th>
        <th bgcolor='#444444' align='center'><font color='#fff'> three</font></th>

        </tr>"
    ;
    // keeps getting the next row until there are no more to get
    while($row $stmt->fetch(PDO::FETCH_ASSOC)) {
        
    // Print out the contents of each row into a table
    echo "<tr><td>";
    echo 
    $row['trans_ref'];
    echo 
    "</td><td>";
    echo 
    ucwords($row['payee']);
    echo 
    "</td><td>";
    echo 
    number_format($row['amount'],2);
    echo 
    "</tr></td>";
    }
    echo 
    "</table>";
    ?>
    <?php 
    echo $pagination ?>
    Last edited by Triple_Nothing; January 10th, 2016 at 09:06 AM.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Posts
    4,372
    Rep Power
    631
    There is a lot of code there and it is difficult to read because you did not use the proper tags. See the sticky at the top of this forum that says READ THIS BEFORE POSTING. Then edit that post using the right tags.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Apr 2009
    Posts
    2,232
    Rep Power
    1296
    There is a lot of code there and it is difficult to read because you did not use the proper tags.
    Are php programmers really incapable of reading code that has not been colorized? I guess you've never had to learn from programming books where the code is almost never colorized.

    Wouldn't it be better to first request the user to use the php code tags and then proceed to help them with their problem. If the color is that important, you could simply copy/paste the code into your favorite editor which adds the color.

    Comments on this post

    • Triple_Nothing agrees : It being colored is a pleasurable feature. If it's simply the color is required, one can copy/paste to their own editor.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Posts
    4,372
    Rep Power
    631
    Don't be silly. This is a voluntary forum and you know that. I'm not going to spend a lot of unnecessary time reading formatted code. </flame>
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2008
    Posts
    80
    Rep Power
    0
    you really do not need to throw words on people cos they made there comment, i think its not civil. But what fishMonger said i dont think theres anything wrong with it. you dont want to answer to a question you dont have to. its plain simple
  10. #6
  11. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Location
    Adelaide - Australia
    Posts
    167
    Rep Power
    11
    Originally Posted by funkyfela
    If you don't want to answer to a question you don't have to. Its plain simple
    I totally agree..

    If anything - It's up to the Moderators to "Lay down the rules" ?
  12. #7
  13. No Profile Picture
    Super Moderator
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2009
    Location
    Hartford, WI
    Posts
    1,508
    Rep Power
    111
    Now, back to the OP...

    I re-wrote this in hopes maybe I would more easily see the issue, but with no luck. Is anyone able to see an issue in this version?
    PHP Code:
    <?php 
      
    ////////////////////////////// 
      // Define our settings 
      ////////////////////////////// 
      
    error_reporting(E_ALL & ~E_NOTICE); 
      
    $agent $_GET['id'];                     // What is the agent's id? 
      
    $tbl_name 'processed';                  // What is the table name? 
      
    $adjacents 5;                           // How many adjacent pages should be shown on each side? 
      
    $targetpage 'view-commission.php';      // What is the name of this file? 
      
    $limit 3;                               // How many items should appear per page? 
      
    $page = (isset($_GET['page']) ? $_GET['page'] : 1); // What page are we displaying? 
      
    $start = ($page 1) * $limit;            // What row are we starting this page on? 

      ////////////////////////////// 
      // Fetch our data 
      ////////////////////////////// 
      
    $stmt $pdo->query('SELECT surname, firstname FROM confirmed WHERE username = "' $agent '";'); 
      
    $row $stmt->fetch(PDO::FETCH_ASSOC); 
      
    $_SESSION['ref_agent'] = $row['surname'] . " "$row['firstname']; 
       
      
    $stmt $pdo->query('SELECT COUNT(*) AS num FROM ' $tbl_name ' WHERE invitee = "' $agent '";'); 
      
    $total_pages $stmt->fetch(PDO::FETCH_ASSOC); 
      
    $total_pages $total_pages['num']; 
       
      
    $rows NULL
      
    $stmt $pdo->query('SELECT * FROM ' $tbl_name ' WHERE invitee = ' $agent ' ORDER BY date_processed DESC LIMIT ' $start ', ' $limit ';'); 
      while(
    $row $stmt->fetch(PDO::FETCH_ASSOC)) { 
        
    $rows .= '      <TR><TD>' $row['trans_ref'] . '</TD><TD>' ucwords($row['payee']) . '</TD><TD>' number_format($row['amount'], 2) . "</TD></TR>\n"
      } 
      
    $pagination NULL
      if(
    $lastpage 1) {     
        
    $pagination .= '    <DIV class="pagination">' "\n"
        if(
    $page 1) { // Previous button 
          
    $pagination .= '      <A href="' $targetpage '?page=' . ($page 1) . '"> previous</A>' "\n"
        } else { 
          
    $pagination .= '      <SPAN class = "disabled"> previous</SPAN>' "\n";     
        } 
        if(
    $lastpage + ($adjacents 2)) {  //not enough pages to bother breaking it up     
          
    for($counter 1$counter <= $lastpage$counter++) { 
            if(
    $counter == $page) { 
              
    $pagination .= '      <SPAN class="current">' $counter '</SPAN>' "\n"
            } else { 
              
    $pagination .= '      <A href="' $targetpage '?page=' $counter '">' $counter '</A>' "\n";                     
            } 
          } 
        } elseif(
    $lastpage + ($adjacents 2)) { //enough pages to hide some 
          
    if($page + ($adjacents 2)) {  // Close to beginning. Only hide later pages 
            
    for($counter 1$counter + ($adjacents 2); $counter++) { 
              if(
    $counter == $page) { 
                
    $pagination .= '    <SPAN class="current">' $counter '</SPAN>' "\n"
              } else { 
                
    $pagination .= '    <A href="' $targetpage '?page=' $counter '">' $counter '</A>' "\n"
              }                     
            } 
            
    $pagination .= '      ...'
            
    $pagination .= '      <A href="' $targetpage '?page=' $lpm1 '">' $lpm1 '</A>' "\n"
            
    $pagination .= '      <A href="' $targetpage '?page=' $lastpage '">' $lastpage '</A>' "\n";         
          } elseif(
    $lastpage - ($adjacents 2) > $page && $page > ($adjacents 2)) {  // In middle. Hide ends 
            
    $pagination .= '      <A href="' $targetpage '?page=1">1</A>' "\n"
            
    $pagination .= '      <A href="' $targetpage '?page=2">2</A>' "\n"
            
    $pagination .= '      ...' "\n"
            for(
    $counter $page $adjacents$counter <= $page $adjacents$counter++) { 
              if(
    $counter == $page) { 
                
    $pagination .= '      <SPAN class="current">' $counter '</SPAN>' "\n"
              } else { 
                
    $pagination .= '      <A href="' $targetpage '?page=' $counter '">' $counter '</A>' "\n"
              }                     
            } 
            
    $pagination .= '      ...' "\n"
            
    $pagination .= '      <A href="' $targetpage '?page=' $lpm1 '">' $lpm1 '</A>' "\n"
            
    $pagination .= '      <A href="' $targetpage '?page=' $lastpage '">' $lastpage '</A>' "\n";         
          } else {  
    // Close to end. Only hide early pages 
            
    $pagination .= '      <A href="' $targetpage '?page=1">1</A>' "\n"
            
    $pagination .= '      <A href="' $targetpage '?page=2">2</A>' "\n"
            
    $pagination .= '      ...' "\n"
            for(
    $counter $lastpage - (+ ($adjacents 2)); $counter <= $lastpage$counter++) { 
              if(
    $counter == $page) { 
                
    $pagination .= '      <SPAN class="current">' $counter '</SPAN>' "\n"
              } else { 
                
    $pagination .= '      <A href="' $targetpage '?page=' $counter '">' $counter '</A>' "\n"
              }                     
            } 
          } 
        } 
        if(
    $page $counter 1) {  // Next button 
          
    $pagination .= '      <A href="' $targetpage '?page=' $next '">next </A>' "\n"
        } else { 
          
    $pagination .= '      <SPAN class="disabled">next </SPAN>' "\n"
        } 
        
    $pagination .= '    </DIV>';         
      } 
    ?><!DOCTYPE HTML> 
    <HTML> 
      <HEAD> 
        <TITLE>pagination-page2-972557</TITLE> 
      </HEAD> 
      <BODY> 
        <TABLE width="100%" class="table table-striped"> 
          <TR> 
            <TH bgcolor="#444444" align="center"><FONT color="#fff">one</FONT></TH> 
            <TH bgcolor="#444444" align="center"><FONT color="#fff">two</FONT></TH> 
            <TH bgcolor="#444444" align="center"><FONT color="#fff">three</FONT></TH> 
          </TR> 
    <?= $rows?> 
        </TABLE> 
    <?= $pagination?> 
      </BODY> 
    </HTML>
    Last edited by Triple_Nothing; January 11th, 2016 at 02:26 PM.
    He who knows not that he knows not is a fool, ignore him. He who knows that he knows not is ignorant, teach him. He who knows not that he knows is asleep, awaken him. He who knows that he knows is a leader, follow him.
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Apr 2009
    Posts
    2,232
    Rep Power
    1296
    I have not found the source of the problem yet, but finding it would be easier if we get rid if the unnecessary concatenation (which php programmers love to use) and use proper indentation as well as additional vertical and horizontal whitespace.
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2008
    Posts
    80
    Rep Power
    0
    Originally Posted by Triple_Nothing
    Now, back to the OP...

    I re-wrote this in hopes maybe I would more easily see the issue, but with no luck. Is anyone able to see an issue in this version?
    PHP Code:
    <?php 
      
    ////////////////////////////// 
      // Define our settings 
      ////////////////////////////// 
      
    error_reporting(E_ALL & ~E_NOTICE); 
      
    $agent $_GET['id'];                     // What is the agent's id? 
      
    $tbl_name 'processed';                  // What is the table name? 
      
    $adjacents 5;                           // How many adjacent pages should be shown on each side? 
      
    $targetpage 'view-commission.php';      // What is the name of this file? 
      
    $limit 3;                               // How many items should appear per page? 
      
    $page = (isset($_GET['page']) ? $_GET['page'] : 1); // What page are we displaying? 
      
    $start = ($page 1) * $limit;            // What row are we starting this page on? 

      ////////////////////////////// 
      // Fetch our data 
      ////////////////////////////// 
      
    $stmt $pdo->query('SELECT surname, firstname FROM confirmed WHERE username = "' $agent '";'); 
      
    $row $stmt->fetch(PDO::FETCH_ASSOC); 
      
    $_SESSION['ref_agent'] = $row['surname'] . " "$row['firstname']; 
       
      
    $stmt $pdo->query('SELECT COUNT(*) AS num FROM ' $tbl_name ' WHERE invitee = "' $agent '";'); 
      
    $total_pages $stmt->fetch(PDO::FETCH_ASSOC); 
      
    $total_pages $total_pages['num']; 
       
      
    $rows NULL
      
    $stmt $pdo->query('SELECT * FROM ' $tbl_name ' WHERE invitee = ' $agent ' ORDER BY date_processed DESC LIMIT ' $start ', ' $limit ';'); 
      while(
    $row $stmt->fetch(PDO::FETCH_ASSOC)) { 
        
    $rows .= '      <TR><TD>' $row['trans_ref'] . '</TD><TD>' ucwords($row['payee']) . '</TD><TD>' number_format($row['amount'], 2) . "</TD></TR>\n"
      } 
      
    $pagination NULL
      if(
    $lastpage 1) {     
        
    $pagination .= '    <DIV class="pagination">' "\n"
        if(
    $page 1) { // Previous button 
          
    $pagination .= '      <A href="' $targetpage '?page=' . ($page 1) . '"> previous</A>' "\n"
        } else { 
          
    $pagination .= '      <SPAN class = "disabled"> previous</SPAN>' "\n";     
        } 
        if(
    $lastpage + ($adjacents 2)) {  //not enough pages to bother breaking it up     
          
    for($counter 1$counter <= $lastpage$counter++) { 
            if(
    $counter == $page) { 
              
    $pagination .= '      <SPAN class="current">' $counter '</SPAN>' "\n"
            } else { 
              
    $pagination .= '      <A href="' $targetpage '?page=' $counter '">' $counter '</A>' "\n";                     
            } 
          } 
        } elseif(
    $lastpage + ($adjacents 2)) { //enough pages to hide some 
          
    if($page + ($adjacents 2)) {  // Close to beginning. Only hide later pages 
            
    for($counter 1$counter + ($adjacents 2); $counter++) { 
              if(
    $counter == $page) { 
                
    $pagination .= '    <SPAN class="current">' $counter '</SPAN>' "\n"
              } else { 
                
    $pagination .= '    <A href="' $targetpage '?page=' $counter '">' $counter '</A>' "\n"
              }                     
            } 
            
    $pagination .= '      ...'
            
    $pagination .= '      <A href="' $targetpage '?page=' $lpm1 '">' $lpm1 '</A>' "\n"
            
    $pagination .= '      <A href="' $targetpage '?page=' $lastpage '">' $lastpage '</A>' "\n";         
          } elseif(
    $lastpage - ($adjacents 2) > $page && $page > ($adjacents 2)) {  // In middle. Hide ends 
            
    $pagination .= '      <A href="' $targetpage '?page=1">1</A>' "\n"
            
    $pagination .= '      <A href="' $targetpage '?page=2">2</A>' "\n"
            
    $pagination .= '      ...' "\n"
            for(
    $counter $page $adjacents$counter <= $page $adjacents$counter++) { 
              if(
    $counter == $page) { 
                
    $pagination .= '      <SPAN class="current">' $counter '</SPAN>' "\n"
              } else { 
                
    $pagination .= '      <A href="' $targetpage '?page=' $counter '">' $counter '</A>' "\n"
              }                     
            } 
            
    $pagination .= '      ...' "\n"
            
    $pagination .= '      <A href="' $targetpage '?page=' $lpm1 '">' $lpm1 '</A>' "\n"
            
    $pagination .= '      <A href="' $targetpage '?page=' $lastpage '">' $lastpage '</A>' "\n";         
          } else {  
    // Close to end. Only hide early pages 
            
    $pagination .= '      <A href="' $targetpage '?page=1">1</A>' "\n"
            
    $pagination .= '      <A href="' $targetpage '?page=2">2</A>' "\n"
            
    $pagination .= '      ...' "\n"
            for(
    $counter $lastpage - (+ ($adjacents 2)); $counter <= $lastpage$counter++) { 
              if(
    $counter == $page) { 
                
    $pagination .= '      <SPAN class="current">' $counter '</SPAN>' "\n"
              } else { 
                
    $pagination .= '      <A href="' $targetpage '?page=' $counter '">' $counter '</A>' "\n"
              }                     
            } 
          } 
        } 
        if(
    $page $counter 1) {  // Next button 
          
    $pagination .= '      <A href="' $targetpage '?page=' $next '">next </A>' "\n"
        } else { 
          
    $pagination .= '      <SPAN class="disabled">next </SPAN>' "\n"
        } 
        
    $pagination .= '    </DIV>';         
      } 
    ?><!DOCTYPE HTML> 
    <HTML> 
      <HEAD> 
        <TITLE>pagination-page2-972557</TITLE> 
      </HEAD> 
      <BODY> 
        <TABLE width="100%" class="table table-striped"> 
          <TR> 
            <TH bgcolor="#444444" align="center"><FONT color="#fff">one</FONT></TH> 
            <TH bgcolor="#444444" align="center"><FONT color="#fff">two</FONT></TH> 
            <TH bgcolor="#444444" align="center"><FONT color="#fff">three</FONT></TH> 
          </TR> 
    <?= $rows?> 
        </TABLE> 
    <?= $pagination?> 
      </BODY> 
    </HTML>
    Hello and thanks.
    the issue i noticed so far with this version is here:

    Code:
     $stmt = $pdo->query('SELECT * FROM ' . $tbl_name . ' WHERE invitee = ' . $agent . ' ORDER BY date_processed DESC LIMIT ' . $start . ', ' . $limit . ';'); 
      while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { 
        $rows .= '      <TR><TD>' . $row['trans_ref'] . '</TD><TD>' . ucwords($row['payee']) . '</TD><TD>' . number_format($row['amount'], 2) . "</TD></TR>\n"; 
      }
    I changed it a bit and was able to connect and retrieve data successfully but another problem is that it does not paginate.

    thanks though
  18. #10
  19. No Profile Picture
    Super Moderator
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2009
    Location
    Hartford, WI
    Posts
    1,508
    Rep Power
    111
    Does the first page limit as it should? Or do all rows appear on the first page? You mention "...the other pages empty." As far as the page count, is that defined correctly based on the expected row count?

    What does this echo on the 'blank' pages?
    PHP Code:
    'SELECT * FROM ' $tbl_name ' WHERE invitee = ' $agent ' ORDER BY date_processed DESC LIMIT ' $start ', ' $limit ';' 
    If it appears to echo as desired, copy the echo from that page and run it on your own, and see if it returns the desired results, or helps a bit with why nothing is returning.
    Last edited by Triple_Nothing; January 11th, 2016 at 05:03 PM.
    He who knows not that he knows not is a fool, ignore him. He who knows that he knows not is ignorant, teach him. He who knows not that he knows is asleep, awaken him. He who knows that he knows is a leader, follow him.
  20. #11
  21. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2008
    Posts
    80
    Rep Power
    0
    " If it appears to echo as desired, copy the echo from that page and run it on your own, and see if it returns the desired results, or helps a bit with why nothing is returning"
    I dont get what you are saying here
  22. #12
  23. No Profile Picture
    Super Moderator
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2009
    Location
    Hartford, WI
    Posts
    1,508
    Rep Power
    111
    Well, if you echo your query string to a page, does it appear as you wish? If you copy/paste that into phpMyAdmin, does it work correctly?
    He who knows not that he knows not is a fool, ignore him. He who knows that he knows not is ignorant, teach him. He who knows not that he knows is asleep, awaken him. He who knows that he knows is a leader, follow him.
  24. #13
  25. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2008
    Posts
    80
    Rep Power
    0
    My query works well all along on a simple select statement.
    The problem i am having with it is when i want to use it lets say a search it will echo only the first page but next wont work.
    I guess the problem is that the value is not parsed to the variable see below:

    Code:
    $targetpage = "view-commission.php"; 
    $limit = 3;                               
    $page = $_GET['page'];      // i guess this is where the problem lies
    if($page)
    $start = ($page - 1) * $limit;
    if i could get a two layered pagination script, i will gladly let this one slide away!

    Thanks
  26. #14
  27. No Profile Picture
    Super Moderator
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2009
    Location
    Hartford, WI
    Posts
    1,508
    Rep Power
    111
    $page = $_GET['page']; // i guess this is where the problem lies
    how would this be an issue? does your address contain something like .com/file.php?page=2
    He who knows not that he knows not is a fool, ignore him. He who knows that he knows not is ignorant, teach him. He who knows not that he knows is asleep, awaken him. He who knows that he knows is a leader, follow him.
  28. #15
  29. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2008
    Posts
    80
    Rep Power
    0
    Originally Posted by Triple_Nothing
    how would this be an issue? does your address contain something like .com/file.php?page=2
    yes it does but nothing displays, guess the get page does see the search variable when the next button is clicked
Page 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo