Submitted by alpha_luna on Monday, May 16, 2016 - 11:18.
In this tutorial, we are going to tackle about PHP Limit Data Selections From MySQL. We have to use a LIMIT function to specify the number of our data to display. You can use this codes if you have a pagination table to have multiple pages to minimize the size of your data table.
We are going to set the LIMIT of our data into 4. This is the code.
<?php
require_once('connection.php');
$result=$conn->prepare("SELECT * FROM tbl_registration ORDER BY tbl_registration_id ASC LIMIT 4");
$result->execute();
for($i=0;$row=$result->fetch();$i++){
$id=$row['tbl_registration_id'];
?>
This is the output:
This is our data in the database table.After we code the LIMIT function in the SELECT Statements. The output looks like this:
So what can you say about this work? Share your thoughts in the comment section below or email me at [email protected]. Practice Coding. Thank you very much.