Php/database Table Loop - Display Only 15 Rows At Time
I have a database I'm trying to display for edit through PHP. On the main page I want to show only the first 15 rows of the table then have the user click to generate more table ro
Solution 1:
Use LIMIT:
"SELECT uid, title, description, tblFacilityHrsDateTimes.* FROM tblFacilityHrs LEFT JOIN tblFacilityHrsDateTimes ON tblFacilityHrs.uid = tblFacilityHrsDateTimes.owner_uid ORDER BY tblFacilityHrs.title LIMIT 15"Solution 2:
Probably you are looking for Pagination, this can be done through mysql LIMIT
Something like that
$result = $mysqli->query("SELECT uid, title, description, tblFacilityHrsDateTimes.* FROM tblFacilityHrs LEFT JOIN tblFacilityHrsDateTimes ON tblFacilityHrs.uid = tblFacilityHrsDateTimes.owner_uid ORDER BY tblFacilityHrs.title LIMIT 15, $page ")
Where $page is for offset
Here are few tutorial for creating custom pagination
Solution 3:
Check out the limit syntax in this manual page. select * from table limit 0,15 will return 15 rows starting with offset 0 (the first row). For the second page you'd use limit 15, 15 to get rows 16-30, then limit 30,15 and so on.
Solution 4:
You need to look at Paging. This tutorial may help: http://www.php-mysql-tutorial.com/wikis/php-tutorial/paging-using-php.aspx
Post a Comment for "Php/database Table Loop - Display Only 15 Rows At Time"