title: PHP MySQL Paging
body: <p>I tried so many different solutions. Im new to php since 1 week, used ASP 12 years ago so I hope I can get some help.</p>
  
  <p>Everything down here works fine. But there are around 1000 rows in the db and I need to split them up in pages.</p>
  
  <pre><code>&lt;?php
  $con = mysqli_connect("localhost","test","test","test")or die('could not connect to database');
  
  // Check connection
  if (mysqli_connect_errno())
    {
     echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }
  
  echo "&lt;table border='0'&gt;
   &lt;tr&gt;
    &lt;th&gt;Img:&lt;/th&gt;
    &lt;th&gt;Text:&lt;/th&gt;
   &lt;/tr&gt;";
  
  $result = mysqli_query($con,"SELECT Jokes.ID, Categories.CategoryName, Jokes.CategoryID, Jokes.JokeText FROM Jokes LEFT JOIN Categories ON Jokes.CategoryID = Categories.ID ORDER BY  Jokes.JokeText");
  
  while($row = mysqli_fetch_array($result))
    {
  
     echo "&lt;tr&gt;";
     echo "&lt;td align='center'&gt;&lt;img src='webimg/" . $row['CategoryName'] . ".png' height='35' width='35'&gt;&lt;/td&gt;";
     echo "&lt;td align='left'  width='80%'&gt;" . $row['JokeText'] . "&lt;/td&gt;";
     echo "&lt;/tr&gt;";
  
    }
  echo "&lt;/table&gt;";
  
  mysql_close($con);
  ?&gt;
  </code></pre>
  
  <p>Kind Regards.</p>