Jump to content

The_Anomaly

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Posts posted by The_Anomaly

  1. i have everything pretty much working but its displaying everything not just 5 at a time as i would like it to. I cant seem to find whats wrong. when i click the 1,2,3 links the page in the address bar says it has changed but all fields are still the same. Wanna take a look :)

    [code]
    <?php

        require_once('Connections/nwodb.php');
        @mysql_select_db("nwo") or die("ERROR--CAN'T CONNECT TO DB");
       


        $limit          = 5;              
        $query_Recordset1    = "SELECT * FROM person ORDER BY LastName ASC";   
        $result_count  = mysql_query($query_Recordset1);   
        $totalrows      = mysql_num_rows($result_count);
     

        if(empty($page))
    {
            $page = 1;
            }
           

        $limitvalue = $page * $limit - ($limit); 
        //$query_Recordset1  = "SELECT * FROM person ORDER BY LastName ASC";       
        //$result = mysql_query($query) or die("Error: " . mysql_error()); 
         
          $Recordset1 = mysql_query($query_Recordset1, $nwodb) or die(mysql_error());
          $row_Recordset1 = mysql_fetch_assoc($Recordset1);
          $totalRows_Recordset1 = mysql_num_rows($Recordset1);
        if(mysql_num_rows($Recordset1) == 0)
    {
            echo("Nothing to Display!");
            }

        $bgcolor = "#E0E0E0"; // light gray

        echo("<table>");
        echo("<tr><td>");
        echo("Member_ID");
        echo("</td><td>");
        echo("Last Name");
        echo("</td><td>");
        echo("First Name");
        echo("</td></tr>");
       
        while($row_Recordset1 = mysql_fetch_array($Recordset1))
        {
            if ($bgcolor == "#E0E0E0")
      {
                $bgcolor = "#FFFFFF";
                }else
          {
                    $bgcolor = "#E0E0E0";
                  }
     
        echo("<tr bgcolor=".$bgcolor."><td width=\"20%\">");
        echo ($row_Recordset1["Person_ID"]);
        echo ("</td><td width=\"40%\">");     
        echo($row_Recordset1["LastName"]);
                      echo ("</td><td>");       
        echo($row_Recordset1["FirstName"]);
        echo("</td></tr>");
        }

        echo("</table>");
    //shows the previous # entries link
        if($page != 1){ 
            $pageprev = $page--;         
            echo("<a href=\"pagation.php=$pageprev\">PREV".$limit."</a> "); 
        }else
              {
            echo("PREV ".$limit." ");
          }
    //shows the number of pages that can be selected from
        $numofpages = $totalrows / $limit;     
        for($i = 1; $i <= $numofpages; $i++)
          {
            if($i == $page)
              {
                echo($i." ");
              }else
                {
                    echo("<a href=\"pagation.php?page=$i\">$i</a> ");
                }
              }

    //shows the next # enties link
        if(($totalrows % $limit) != 0)
          {
            if($i == $page){
                echo($i." ");
            }else
              {
                echo("<a href=\"pagation.php?page=$i\">$i</a> ");
              }
          }

        if(($totalrows - ($limit * $page)) > 0){
            $pagenext = $page++;         
            echo("<a href=\"pagation.php?page=$pagenext\">NEXT ".$limit."</a>"); 
        }else{
            echo("NEXT ".$limit); 
        }
       
        mysql_free_result($Recordset1);

    ?>
    [/code]

    I know its sloppy right now :|
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.