如何显示具有特定限制数据的数据库中的数据?

hi guy's i need help from you.. i have a problem while selecting data from database with a specific limit data that i need to show or display. i want to display data between 40 to 80 but when the data displaying, the data that showing is from 40 to 81( and it can reach more of 81). i use this function to select that data.

<?php
$con=mysqli_connect("localhost","root","","silo");

if (!$con) {
  die('Could not connect: ' . mysql_error());
}


// Data for Titik1
$query = mysqli_query($con,"SELECT * FROM temp2 LIMIT 40, 78");
$rows = array();

while($tmp= mysqli_fetch_assoc($query)) {
    $rows[] = $tmp;
}

echo json_encode($rows);
mysqli_close($con);
?> 

Your query needs some corrections. Go through this tutorial for more details: https://www.w3schools.com/php/php_mysql_select_limit.asp

If you want to get records from 40 to 80 then your query should be:

SELECT * FROM temp2 LIMIT 39, 41