Skip to content
Advertisement

MySQLi PHP Extension Problems

Whenever a query finishes executing, I know you should free the result. Here is a snippet of a class I built for running a simple query. Could someone tell me where I went wrong? The query, when entered properly, runs successfully. It’s just that my page doesn’t reload like it, should but it gives me these errors…

JavaScript

… and this error …

JavaScript

Here a simplified version of my code:

JavaScript

Advertisement

Answer

If I follow your link to the manual, there is something mentioned about the return value

Returns FALSE on failure. For successful SELECT, SHOW, DESCRIBE or EXPLAIN queries mysqli_query() will return a result object. For other successful queries mysqli_query() will return TRUE.

Especially you don’t handle the two cases true and more important false

JavaScript

I don’t know, what $query is in your case, but query() will only return a result, if there is one (SELECT-query).

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement