MySql Limit Data ?

MySQL Limit Data

‘LIMIT’ clause is used to show the limited result from all the data.

For Example:

<?php

$sql=SELECT * FROM students LIMIT 20“;

$result= mysql_query($sql);
$row= mysql_fetch_array($result);

echo $row;

?>

From the above query, the result will show only first 20 students from all the data of the table(students). If you want to get the result between 5 to 20,then the Syntax is:

<?php

$sql=SELECT * FROM students LIMIT 4,15“;

$result= mysql_query($sql);
$row= mysql_fetch_array($result);

echo $row;

?>

Here number ‘4’ is used to get the result after the 4th value and number ’15’ is used to show 15 values continue after the 4th value.


onTime It Solution

onTime IT Solution always happy to serve you in Information Technology (IT). Learn HTML, CSS, Javascript, PHP, Android, Digital Marketing, Latest IT News and many more.

Leave a Reply

Your email address will not be published. Required fields are marked *