title: Creating multiple pages from sql query
body: <p>I am trying to create multiple pages from my query. If I have 100 results, and I want 10 results per page, I would like there to be ten pages created, with each page showing a different query. This is how my query is set up:</p>
  
  <pre><code>$sql ="SELECT * FROM Post WHERE (active ='1') ORDER BY PostID DESC ";
  $result = mysql_query($sql,$db);
  $numrows = mysql_num_rows($result);
  
  while(($post = mysql_fetch_assoc($result))) {
  $posts[] = $post;
  }
  
  
   &lt;?php
  if (!$numrows){ echo $errormessage;}
  else{
  
  
   foreach($posts as $post): ?&gt;
  
   echo stripslashes($post['text']);  
  
   &lt;?php endforeach; }?&gt;
  </code></pre>
  
  <p>This pulls each "post" from the database and puts displays them all out.</p>
  
  <p>I would like to do something like this:</p>
  
  <pre><code>$results = mysql_num_rows($result);
  
  
  $numpages = 10/$results; //gives the number of pages
  
  while($numpages&lt;$results)
  {
  
  //run code from above\\
  }
  </code></pre>
  
  <p>What is the best way to do this with the method that I use? I appreciate your opinions because I'm at one of those stages where I'm lost in my own logic. Thank You!</p>