- 1

Please Help Me On PHP Pagination

This is My Page Link:- "threads.php?catid='.$id.'?" Now i Want add the Page Number in the link:- &page='.$i.' Now My final Link will be this:- "threads.php?catid='.$id.'?&page='.$i.'" link is working perfectly but when i click on next or previous pages its shows ana error, whis is:- Fatal error: Uncaught TypeError: mysqli_fetch_assoc(): Argument #1 ($result) must be of type mysqli_result, bool given in C:\xampp\htdocs\php\PHP Form\threads.php:28 Stack trace: #0 C:\xampp\htdocs\php\PHP Form\threads.php(28): mysqli_fetch_assoc(false) #1 {main} thrown in C:\xampp\htdocs\php\PHP Form\threads.php on line 28 This link is working correctly -> threads.php?catid='.$id.'? After clcking on a page number of the same page, my url changed to -> threads.php?catid='.$id.'?&page='.$i.' but the an error ocurred (given above) Please Help Me

19th Oct 2021, 10:38 AM
Dipak Majumdar
Dipak Majumdar - avatar
7 Antworten
+ 1
"($result) must be of type mysqli_result, bool given" This error *usually* happens when a query failed, in which mysqli_query returns a boolean false. You need to anticipate this by checking whether or not the query succeeded and did return a valid resource (a mysqli_result object) before you try to fetch anything. An example here might help https://www.w3schools.com/PHP/func_mysqli_query.asp
19th Oct 2021, 11:42 AM
Ipang
+ 1
Query is running successfully on the page:- threads.php?catid='.$id.' But not running on the page links:- "threads.php?catid='.$id.'&page='.i.'"
19th Oct 2021, 12:21 PM
Dipak Majumdar
Dipak Majumdar - avatar
+ 1
What that "page" argument for though? to define OFFSET in the query? Maybe you can try to run that failing query directly against the server to verify why it failed. I have no idea why that "page" argument changes how the code work cause Idk what's inside threads.php
19th Oct 2021, 12:42 PM
Ipang
+ 1
Ipang can you please send me your contact detail, i want to contact you personally.
19th Oct 2021, 12:53 PM
Dipak Majumdar
Dipak Majumdar - avatar
0
Sorry bro, I don't do direct contacts XD But if, and when I can, I'd be sure to help, with what I can, and what I know ...
19th Oct 2021, 12:55 PM
Ipang
0
Dipak bro, Rather copy that threads.php into SoloLearn and share its link here https://www.sololearn.com/post/75089/?ref=app I'm on slow network, I don't prefer videos if possible ...
19th Oct 2021, 12:57 PM
Ipang
0
Ok i will post the link with discussed problem
19th Oct 2021, 1:00 PM
Dipak Majumdar
Dipak Majumdar - avatar