Click here to Skip to main content
15,446,510 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi I am getting an error with this line of code
Error: Fatal error: Uncaught TypeError: mysqli_fetch_assoc(): Argument #1 ($result) must be of type mysqli_result, bool given

<pre lang="PHP>while($stock = mysqli_fetch_assoc($item))">

What I have tried:

I have searched on stackoverflow
Posted
Updated 16-Mar-22 20:25pm

Look at the documentation: PHP: mysqli_result::fetch_assoc - Manual[^] - it explains what type of data the parameter must be, and provides an example of code to use it.
Compare that code with yours - and we can't see the code than generates $item - and the error should be pretty obvious.
 
Share this answer
 
It seems, you are passing some arguments to database with incorrect way. Check the following link. search - PHP variables don't evaluate in the query - Stack Overflow[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900