Home › Forums › Back End › mysqli_fetch_assoc() expects parameter 1 to be mysqli_result error › Re: mysqli_fetch_assoc() expects parameter 1 to be mysqli_result error
> How would I go about writing a code that would work.
In Very General Terms,
… write code
… test code
… **describe problems, or no one will be able to help**
… rewrite code
… test again
> I got this code from my school and it doesn’t seem to work.
What do you mean by that? “it doesn’t work” is very, very useless information. Are you still getting the same error regarding `mysqli_fetch_assoc()`? Something else? Does it reach a certain point and then break? Is there any output at all?
I could describe a few things wrong with that code, but I doubt any of them are the problem you’re asking about. Did you note my comment above about *checking if the query was successful* before trying to use the results? Do you have (or have you tried) such a control structure in your code already?