hi everyone,
I try to get data limited from table into database, I tried to change and add this code
“$sql = “SELECT * FROM Orders LIMIT 30”;”
but to no avail.
What I mean by limited data, for example I have 8 tables (data), I don’t want to call them from the beginning, I want to call them from the third (data) table. what changes will I make to the code?, below are the codes to be modified.
Thanks in advance for giving me a part of your precious time and helping you to me, my regards.
<?php
if (isset($_GET['pageno'])) {
$pageno = $_GET['pageno'];
} else {
$pageno = 1;
}
$no_of_records_per_page = 6;
$offset = ($pageno-1) * $no_of_records_per_page;
$total_pages_sql = "SELECT COUNT(*) FROM tblposts";
$result = mysqli_query($con,$total_pages_sql);
$total_rows = mysqli_fetch_array($result)[0];
$total_pages = ceil($total_rows / $no_of_records_per_page);
$query=mysqli_query($con,"select tblposts.id as pid,tblposts.PostTitle as posttitle,tblposts.PostImage,tblcategory.CategoryName as category,tblcategory.id as cid,tblsubcategory.Subcategory as subcategory,tblposts.PostDetails as postdetails,tblposts.PostingDate as postingdate,tblposts.PostUrl as url from tblposts left join tblcategory on tblcategory.id=tblposts.CategoryId left join tblsubcategory on tblsubcategory.SubCategoryId=tblposts.SubCategoryId where tblposts.Is_Active=1 order by tblposts.id desc LIMIT $offset, $no_of_records_per_page");
while ($row=mysqli_fetch_array ($query)) {
?>
ADMIN EDIT: Added Code Tags