What is mysql errno in PHP

In this article I am going to explain about mysql_errno function in PHP.
  • 1583

PHP mysql_errno() Function

The PHP mysql_errno function
returns the numerical value of the error message from previous MySQL operation. This function returns zero(0) if no error has occurred.

Syntax of mysql_errno function

mysql_errno(connection)


Parameters in
mysql_errno function

It has only one parameter:
 

Parameter Description
connection It specifies mysql connection.

Example of mysql_errno function

<html>

<body>

<?php

$con=@mysql_connect("localhost","MySQLUserName","MySQLPassword"); //Here we are taken wrong username and password.

if(!$con)

{

die("Could not connect:". mysql_errno());

}

mysql_close($con);

?>

</body>

</html>


Output:

mysql-errno-php.jpg

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

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.