Jump to content

mysqli_query() error logging


Ustag

Recommended Posts

Hi, I have a mysqli_query that goes like this:

 

$result = mysqli_query($db, "INSERT INTO device(`Identifier`, `IsAllowedToPost`)VALUES('ABC123', 0)") or die(error_log(mysqli_error($db), 3, "php_error.log"));
It does not work and the logs either tells me "1", "0" or nothing depending on which method I try to log the error with. How can I get a better error message to log in my file? 1 or 0 means nothing to me.
The current code gives me no error message at all in my file and the data does not get stored in the database.
Edited by Ustag
Link to comment
Share on other sites

The browser is either going to show 1 or nothing, because the return value of error_log is a boolean. The error should show up in that log file though, you don't see an error there? Does PHP have access to write to that file?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...