Multiple pages PHP how?
<p>Here I have a problem in this code .. </p>

<p>I want to specify the 4 values in each page .. 
But I can not ... So far there is a problem, I think, in limit </p>

<pre><code>&lt;?php 

if ( !isset( $_GET["page"] ) ) 
{ 
  $page = 1; 
  include( "connect.php" );  
} else { 
  $page = intval( $_GET['page'] ); 
} 
$max  = 4; 
$from = ($max * $page) - $max; 
$sql  = mysql_query( "
  select *
    from uploads
       , members
       , rooms
   where uploads.MemberID = members.MemberID
     and uploads.RoomID = rooms.RoomID
     and UploadCategory = 'L'
   order by UploadID desc
   limit $from, $max
");  

$num_sql = mysql_num_rows( $sql ); 
$pages   = ceil( $num_sql / $max ); 
$num     = mysql_num_rows( $sql ); 

?&gt; 

&lt;table width="400" border="0" cellspacing="1" cellpadding="0"&gt; 
  &lt;tr&gt; 
    &lt;td&gt;
      &lt;form name="form1" method="post" action=""&gt; 
        &lt;div align="center"&gt; 
          &lt;table width="400" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC"&gt; 
            &lt;tr&gt; 
              &lt;td bgcolor="#FFFFFF"&gt;&amp;nbsp;&lt;/td&gt; 
              &lt;td colspan="4" bgcolor="#FFFFFF"&gt; 
                &lt;p align="center"&gt;&lt;font size="4"&gt; file&lt;/font&gt;
              &lt;/td&gt; 
            &lt;/tr&gt; 
            &lt;tr&gt; 
              &lt;td align="center" bgcolor="#FFFFFF"&gt;#&lt;/td&gt; 
              &lt;td align="center" bgcolor="#FFFFFF"&gt;&lt;strong&gt;member&lt;/strong&gt;&lt;/td&gt; 
              &lt;td align="center" bgcolor="#FFFFFF"&gt;&lt;strong&gt; Name&lt;/strong&gt;&lt;/td&gt; 
            &lt;/tr&gt;
          &lt;/table&gt; 
        &lt;/div&gt;
      &lt;/form&gt; 
    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;?php while( $row = mysql_fetch_array( $sql ) ) : ?&gt;
  &lt;tr&gt; 
    &lt;td align="center" bgcolor="#FFFFFF"&gt;&lt;input name="checkbox[]" type="checkbox" id="checkbox[]" value="&lt;?php echo $row['UploadID']; ?&gt;"&gt;&lt;/td&gt; 
    &lt;td bgcolor="#FFFFFF"&gt; &lt;?php echo $row[MemberName]. "&lt;br /&gt;";  ?&gt;&lt;/td&gt; 
    &lt;td bgcolor="#FFFFFF"&gt; &lt;?php echo $row[UpoadName]."&lt;br /&gt;";  ?&gt;&lt;/td&gt; 
  &lt;/tr&gt; 
  &lt;?php endwhile; ?&gt; 
  &lt;tr&gt; 
    &lt;td colspan="5" align="center" bgcolor="#FFFFFF"&gt;&lt;input name="delete" type="submit" id="delete" value="delete"&gt;&lt;/td&gt; 
  &lt;/tr&gt;
&lt;/table&gt;
&lt;?php 

if ( $page &gt; 1 ) 
{ 
  $prev = $page - 1; 
  echo "&lt;a href=" . $PHP_SELF . "?page=$prev\"&gt;prev&lt;/a&gt;"; 
} 
for ( $i = 1; $i &lt;= $pages; $i++ )  
{
  echo ( $page == $i )
    ? " [$i] " 
    : " &lt;a href=" . $PHP_SELF . "?page=$i\"&gt;$i&lt;/a&gt; "; 
} 
if ( $page &lt; $pages ) 
{ 
  $next = $page+1; 
  echo "&lt;a href=" . $PHP_SELF . "?page=$next\"&gt;next&lt;/a&gt;"; 
} 
?&gt;      
&lt;/html&gt; 
</code></pre>

<p>thanks a lot</p>

<h2>EDIT</h2>

<p>Further details</p>

<p><img src="http://up.arab-x.com/Mar10/Xjq83483.jpg" alt="alt text"></p>

<p>I want to the code as in the picture ..</p>

<p>So that if you click on the number 1 to turn to a new page containing the values 4 and No. 2 if you also turn to a new page containing the 4 other values and so on.</p>

<p>What is wrong with this code even shows me output as in the picture</p>

<p>(((Can anyone help me how can I make code works like the picture ..... Please ... Please</p>

<p>Code works, but not like what I want))))))</p>
