Mysqli_error() does not work

mysql, mysqli, php

Solution

Same thing happened to me when I executed an UPDATE statement.

mysqli_error, mysqli_errno and mysqli_error_list were all empty.

Then I discovered that the problem was that the database user assigned to the connection object did not have the UPDATE privilege. I don't know why I did not receive an error message or an error number for this security/privilege breach.

Problem

The following code: ``` $dbc = mysqli_connect("localhost","root","root","magnificantDatabase") or die("Could not connect to database"); $sql = "INSERT INTO accounts(username, password, ip) VALUES('$username','$password','$ip')"; mysqli_query($dbc, $sql) or die(mysqli_error($dbc)); ``` Should return an error when the mysqli_query fails return an error, shouldn't it? It doesn't though :/ Anyone have any ideas why it doesn't? Oh and, by returning no error I mean it returns nothing at all. just completely blank. Edit: I'd like to let you know that after having searched the web (even though as this would seem a common problem) I have -NOT- found anything that fixes this, there are issues close to this one, but none of them I have found appear to be the exact same.

Original source