mysqli_query(): Couldn’t fetch mysqli error [duplicate]

I suspect you’re calling the function multiple times. But it calls mysqli_close($conn) at the end, so when you try to use it the next time you get an error, because $conn can’t be used any more.

Get rid of that line, and close the connection when the script is all done using MySQL (or don’t bother, it will be closed automatically when the script ends).

Leave a Comment