How to use mysql error in PHP
In this article I am going to explain about mysql_error function in PHP.
PHP mysql_error() Function
The PHP mysql_error function returns error message of the last MySQL operation. This function returns a empty string if no error has occurs.
Syntax of mysql_error function
Parameters in mysql_error function
It has only one parameter:
Parameter |
Description |
connection |
It specifies mysql connection. |
Example of mysql_error function
<html>
<body>
<?php
[email protected]_connect("localhost","MySQLUserName","MYSQLPassword"); // Here we are taken wrong username & password.
if(!$con)
{
die(mysql_error());
}
mysql_close($con);
?>
</body>
</html>
|
Output:

You may also want to read these related articles :here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here