This code pretty much just shows a a table with 16 cells (4 columns and 4 rows). Except on the top right, there are two “RESERVED” cells. This code also paginates.
There’s two things I want to fix with this code. Right now the two “RESERVED cells” are the same. Meaning the two cells both say RESERVED. How do I make it so I can change what’s inside the two reserved cell. Sorry if this is a little hard to understand.
Also, I want the two reserved cells to only be shown on the first page. Other than the first page, it would just echo a table with 4×4 cells, as if the reserved cells weren’t there.
Can anyone please make this possible?
Without further ado, here’s the code:
$Page = $_GET["Page"];
if(!$_GET["Page"])
{
$Page=1;
}
$Prev_Page = $Page-1;
$Next_Page = $Page+1;
$Page_Start = (($Per_Page*$Page)-$Per_Page);
if($Num_Rows<=$Per_Page)
{
$Num_Pages =1;
}
else if(($Num_Rows % $Per_Page)==0)
{
$Num_Pages =($Num_Rows/$Per_Page) ;
}
else
{
$Num_Pages =($Num_Rows/$Per_Page)+1;
$Num_Pages = (int)$Num_Pages;
}
$strSQL .=" order by GalleryID ASC LIMIT $Page_Start , $Per_Page";
$objQuery = mysql_query($strSQL);
$cell = 0;
echo '<table border="1" cellpadding="2" cellspacing="1"><tr>';
while($objResult = mysql_fetch_array($objQuery))
{
if($cell % 4 == 0) {
echo '</tr><tr>';
}
if($cell == 2 || $cell == 3) {
echo '<td>RESERVED</td>'; **//How do I make it so there are two separate reserve slots,
rather than one <td> which controls both cells?**
} else {
echo '<td><img src="https://s3.amazonaws.com/thumbnails/' . $objResult["Picture"] . '" />' .
$objResult["GalleryName"] . '</td>'; }
$cell++;
}
echo '</tr></table>';
?>
<br>
view more:
<?php
if($Prev_Page)
{
echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'>prev</a> ";
}
{
echo "|";
}
if($Page!=$Num_Pages)
{
echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>next</a> ";
}
?>
</body>
</html>
<?php
mysql_close($objConnect);
?>
Edit: this was getting a bit frustrating to understand exactly what was happening on your end, so I rewrote this. This is pretty much what your code should look like. If you can’t understand the basic conditionals from here, you need to invest more work in understanding fundamentals on your own time, because a lot of this stuff is rudimentary.