SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Nov 2004
    Location
    california
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    page number links

    hi guys:
    is there a simpler way to make page number links when say records are more than a page. i have one already but i haven't been able to make it in two or 3 lines.
    please check this (http://www.ethioview.com/phpenpals/browse.php) page so that you know what i mean by this. scroll down and look the page number links. they are all in one line ... i want to make them in multi lines.
    sincerely
    heero

  2. #2
    SitePoint Guru
    Join Date
    Oct 2004
    Location
    uk
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try something like this...

    Code:
    <?
    /* Domain count here */
    
    if($count == 0){
    echo "No results";
    }
    
    else if($count > 0){
    echo "Results";
    }
    
    
    if(!isset($_GET['page'])){
    
    
       $page = 1; 
    } else { 
       $page = $_GET['page']; 
    } 
    
    $max_results = 25; 
    
    $from = (($page * $max_results) - $max_results); 
    
    
    /* We set the row count to 0 */
    $row_count = 0; 
    
    
    /* We set the current page number to 1 */
    $x='1';
    
    
    /* Next we run an sql statment and run a while loop to output the search results */
    $get_results = mysql_query("SELECT * FROM table WHERE something LIKE '%$srch%' AND something_else LIKE '%$category%' LIMIT $from,$max_results");
    while($row = mysql_fetch_array($get_results)){  
    
    $row_1 = $row[FIRST_ROW]; 
    
    /* This line determines the color of the next row */
    $row_color = ($row_count % 2) ? $color1 : $color2; 
    
    
    echo "Table here...";
    
    
    /* We tell the script to run again */
    $row_count++; 
    }
    
    // Figure out the total number of results in DB: 
    
    $get_count = mysql_query("SELECT * FROM table WHERE something LIKE '%$srch%' AND something_else LIKE '%$category%'");
    
    $total_results = mysql_num_rows($get_count);
    
    // Figure out the total number of pages. Always round up using ceil() 
    $total_pages = ceil($total_results / $max_results); 
    
    ?>

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2002
    Location
    Australia
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use html by setting the max width in the area where the page numbers are

  4. #4
    SitePoint Member
    Join Date
    Nov 2004
    Location
    california
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    huh guys ... what can i say ?
    thanksssssssssssssssssssssssssssssss i will try this.
    heeero


Bookmarks

Posting Permissions

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