Jump to content
Sign in to follow this  
Ustag

mysqli_query() error logging

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

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...