Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Dec 2007
    Posts
    269
    Thanks
    28
    Thanked 0 Times in 0 Posts

    a different pagination but it does not run

    why does this paginaiton not run ?
    PHP Code:
    $link mysql_connect("localhost","root","123");
    $db mysql_select_db("forum");
    $q1 mysql_query("SELECT * FROM user ORDER BY userid ASC LIMIT $limit");
    $q2 mysql_query("SELECT * FROM user");
    $limit "$v1,$v2";
    $v1 $v2 $i;
    $v2 30;
        
    if(
    $_POST['p'] = $i){
        global 
    $v1$v2$limit;    
        
    $q1 mysql_query("SELECT * FROM user ORDER BY userid ASC LIMIT $limit");    
         while(
    $row mysql_fetch_array($q1)){
              
    printf("%s <br/>" .$row[4]);
        }    
    }

    for(
    $i=0$i mysql_num_rows($q2)/$v2$i++){
        echo 
    '<a href="x.php?p='.$i.'" target="_self">' .$i' </a>';
        } 

  • #2
    Regular Coder
    Join Date
    May 2008
    Location
    Ohio
    Posts
    231
    Thanks
    3
    Thanked 21 Times in 21 Posts
    The first two queries would fail because $limit is defined after you query the database. Come to think of it, why ARE you querying the database? You don't appear to be doing anything with the results of those first two...

    And you're defining $limit using two values that are not defined. Same with $v1.
    Last edited by derzok; 05-15-2008 at 06:44 PM.


  •  

    Posting Permissions

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