MySQL Limit Data | Coding Tag
×

MySQL Limit Data ?

4323

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.



Best WordPress Hosting


Share:


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price



Leave a Reply


Comments
    Waiting for your comments