Reputation: 1130
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? I have no idea what 0 or 1 means.
The current code gives me no error message at all in my file and the test data does not get stored in the database.
Upvotes: 0
Views: 2069
Reputation: 157865
change your code like this
ini_set('log_errors',1);
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
mysqli_connect(credentials);
...
$result = mysqli_query($db, "INSERT INTO device(`Identifier`, `IsAllowedToPost`)
VALUES('ABC123', 0)");
and watch your mysql errors in php error log.
Code you wrote is suffering from some wrong premises.
Upvotes: 2