Here I have a problem in this code ..
I want to specify the 4 values in each page .. But I can not ... So far there is a problem, I think, in limit
<?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 );
?>
<table width="400" border="0" cellspacing="1" cellpadding="0">
<tr>
<td>
<form name="form1" method="post" action="">
<div align="center">
<table width="400" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#FFFFFF"> </td>
<td colspan="4" bgcolor="#FFFFFF">
<p align="center"><font size="4"> file</font>
</td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF">#</td>
<td align="center" bgcolor="#FFFFFF"><strong>member</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong> Name</strong></td>
</tr>
</table>
</div>
</form>
</td>
</tr>
<?php while( $row = mysql_fetch_array( $sql ) ) : ?>
<tr>
<td align="center" bgcolor="#FFFFFF"><input name="checkbox[]" type="checkbox" id="checkbox[]" value="<?php echo $row['UploadID']; ?>"></td>
<td bgcolor="#FFFFFF"> <?php echo $row[MemberName]. "<br />"; ?></td>
<td bgcolor="#FFFFFF"> <?php echo $row[UpoadName]."<br />"; ?></td>
</tr>
<?php endwhile; ?>
<tr>
<td colspan="5" align="center" bgcolor="#FFFFFF"><input name="delete" type="submit" id="delete" value="delete"></td>
</tr>
</table>
<?php
if ( $page > 1 )
{
$prev = $page - 1;
echo "<a href=" . $PHP_SELF . "?page=$prev\">prev</a>";
}
for ( $i = 1; $i <= $pages; $i++ )
{
echo ( $page == $i )
? " [$i] "
: " <a href=" . $PHP_SELF . "?page=$i\">$i</a> ";
}
if ( $page < $pages )
{
$next = $page+1;
echo "<a href=" . $PHP_SELF . "?page=$next\">next</a>";
}
?>
</html>
thanks a lot
EDIT
Further details
I want to the code as in the picture ..
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.
What is wrong with this code even shows me output as in the picture
(((Can anyone help me how can I make code works like the picture ..... Please ... Please
Code works, but not like what I want))))))