0

I have seen a lot of answers which cant really answer to what i need.

Let´s suppose that i have a database with commentaries of users. I wanna limit the commentaries to 10 per page [I know how to make the sql query and limit the results but i still can't figure out how to build the code] The problem is that i dont know how to make the pagination as it can be seen in the next image:

https://i.stack.imgur.com/J7sRt.png Thanks.

This is what i have written:

require("con.php");

$Mystring="SELECT commentaries FROM mydb WHERE 1 LIMIT 25";
$runQuery=mysqli_query($link,$Mystring);
$Myrow=mysqli_num_rows($runQuery);
$commentary=$Myrow['commentaries'];

if($Myrow>=1){ //If there is at least 1 commentary it will be displayed
    echo $commentary;
}
HatZ
  • 1
  • 1
  • Do you have some code so we know where to start helping you? We need a somewhat concrete question. Or tell us what answer you have seen and why it did not help you. – Philipp Jul 02 '16 at 19:35
  • Yes i added it to the question – HatZ Jul 02 '16 at 19:45
  • Get [a count of the total rows](http://stackoverflow.com/questions/5928611/find-total-number-of-results-in-mysql-query-with-offsetlimit) to calculate the pages. – BillyNate Jul 02 '16 at 20:33

0 Answers0