Control data to display from MySQL by putting them into a group
<p>I have a lot of items in my database and I have no problems displaying them. It's just that I want to organize the items that I get from my database by grouping them.</p>

<p>For example I have 50 items and I want to display the first 10 items first, and then hold the rest for later display. So if a user clicked the "view the next items" button or the appropriate number (for example the 10 items are in  "1" and so if the "2" has been clicked it should display the 2nd 10 items, until all items are displayed by 10 along with their corresponding number group items holder), then the next 10 items will be displayed and will replace the first 10 items. In short, I want the items to be displayed by 10.</p>

<p>I have this current code:</p>

<h2>PHP</h2>

<pre><code>$result = mysql_query("SELECT * FROM items");
$data = "";
while($row = mysql_fetch_array($result)) {
    $data .= "&lt;a href='#' id='".$row['id']."' class='theitem'&gt;&lt;img src='media/".$row['picture']."' /&gt;&lt;/a&gt;";
}
</code></pre>

<h2>HTML</h2>

<pre><code>&lt;div id="itemsholder"&gt;
  &lt;? echo $data; ?&gt;
&lt;/div&gt;
</code></pre>

<p>Below the  there should be a numerical navigation and that number should correspond to the number of 10-items set beyond 50 items. For example with 50 items, since I want to display only 10 items, I should have 1, 2, 3, 4, 5 links, or a "display next items" button so that whenever a user hits that, it will display the next 10 items and the rest.</p>

<p>PS: I'm open to suggestions, recommendations and ideas.</p>

<p>Thank you, hope someone here can help, thanks.</p>
