Error updating database php mysql
You get the error description from the last mysqli-function, not from the last mysql-error. $mysqli- Please note that the string returned may contain data initially provided by the user, possibly making your code vulnerable to XSS.
So even if you escape everything in your SQL query using mysqli_real_escape_string(), make sure that if you plan to display the string returned by mysqli_error() you run that string through htmlspecialchars().
See also My SQL: choosing an API guide and related FAQ for more information. Be aware that if you are using multiple My SQL connections you MUST support the link identifier to the mysql_error() function. Just spent a good 30 minutes trying to figure out why i didn't see my SQL errors.'s function, I created the following. It handles both original query, as well as the error log.
Alternatives to this function include: If you want to display errors like "Access denied...", when mysql_error() returns "" and mysql_errno() returns 0, use $php_errormsg. Included Larry Ullman's escape_data() as well since I use it in q().
Also if the database administrator changes the language setting, that affects the language of error messages.
Error codes are stable across GA releases of a given My SQL series.
If you change the connection parameters of the second connection to 127.0.0.1, a new connection is returned. Most often, the output message from My SQL doesn't let you see enough of the query in the error message to let you see where your query went bad- it a missing quote, comma, or ( or ) could have occured well before the error was detected.
A better way is: The decription "mysqli_error -- Returns a string description of the LAST error" is not exactly that what you get from mysqli_error.and print failed if update query was not successful! See Why shouldn't I use mysql_* functions in PHP? Instead you should learn about prepared statements and use either PDO or My SQLi.If you can't decide which, this article will help you. This is because the names used for the 64bit Apache and My SQL services has been changed from the standard wampapache and wampmysql to wampapache64 and wampmysql64, so the 32bit services and the 64 bit services now have different names.BUT DONT run them both at the same time of course as both Apache servers will still try to run on port 80 and both My SQL servers on port 3306.