Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code>if($cell == 2) { echo '&lt;td&gt;RESERVED&lt;/td&gt;'; } elseif ($cell == 3) { echo '&lt;td&gt;The other cell&lt;/td&gt;'; } else { echo '&lt;td&gt;&lt;img src="https://s3.amazonaws.com/thumbnails/' . $objResult["Picture"] . '" /&gt;' . $objResult["GalleryName"] . '&lt;/td&gt;'; } $cell++; } </code></pre> <p><em>Edit</em>: 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.</p> <pre><code>$Page = max((int)$_GET["Page"], 1); $Prev_Page = $Page - 1; $Next_Page = $Page + 1; $Page_Start = max(0, ($Per_Page * ($Page - 1) - 2)); if ($Page === 1) $Per_Page = $Per_Page - 2; $Num_Pages = ceil($Num_Rows / $Per_Page); $strSQL .= "ORDER BY GalleryID ASC LIMIT {$Page_Start},{$Per_Page}"; $objQuery = mysql_query($strSQL); $cell = 0; $total = mysql_num_rows($objQuery); ?&gt; &lt;table border="1" cellpadding="2" cellspacing="1"&gt; &lt;? for ($cell = 0; $cell &lt; $total; ++$cell) : ?&gt; &lt;? if ($cell % 4 === 0) : ?&gt; &lt;tr&gt; &lt;? endif; ?&gt; &lt;td&gt; &lt;? if ($Page === 1 &amp;&amp; $cell === 2) : ?&gt; First reserved cell &lt;? --$cell; ?&gt; &lt;? elseif ($Page === 1 &amp;&amp; $cell === 3) : ?&gt; Second reserved cell &lt;? --$cell; ?&gt; &lt;? else: ?&gt; &lt;? $objResult = mysql_fetch_array($objQuery); ?&gt; &lt;img src="https://s3.amazonaws.com/thumbnails/&lt;?=$objResult["Picture"]; ?&gt;" /&gt; &lt;?=$objResult["GalleryName"]; ?&gt; &lt;? endif; ?&gt; &lt;/td&gt; &lt;? if ($cell % 4 === 3) : ?&gt; &lt;/tr&gt; &lt;? endif; ?&gt; &lt;? endfor; ?&gt; &lt;/table&gt; &lt;br&gt; view more: &lt;?php if($Prev_Page) { echo " &lt;a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'&gt;prev&lt;/a&gt; "; if($Page != $Num_Pages) echo " | "; } if($Page != $Num_Pages) { echo " &lt;a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'&gt;next&lt;/a&gt; "; } ?&gt; &lt;/body&gt; &lt;/html&gt; &lt;?php mysql_close($objConnect); ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload