SQL PHP HTML ASP JavaScript articles and free scripts to download
 
 

Error number displaying after execution of a query

MySQL query on error returns an error number for reference. This error number can be collected or can be further processed as per requirement. Even we can post the error number along with error message to an email address. Getting the error number is simple. We have to use mysql_errno(). Please note that this command will return the error number associated with most recent mysql query. It will return zero if no error is associated. So we have to check this before going to next mysql query. Printing error message along with error number is a good idea. Here is an example of this error number. Let us see what error we will get in case of generated error out of one non existence field name called in an mysql select query.
Related Tutorial
Printing Error message
Posting error message to an email address
PHP MySQL functions
$querry = mysql_query("SELECT new_field FROM student");

echo "Error Number= ".mysql_errno(); // will print 1054

In the above table student new_field is a non existence field or column. We will get a meaningful interpretation if we can mix this error number with error message. Next we will study that..

Discuss this tutorial at forum

List of SQL Tutorials


 
Scripts
PHP
JavaScript
HOME
SQL Tutorial List
SQL (Home)
SQL Commands
AVG
Alter Table
Between
Count
Copy Table
Create Table
Delete
Distinct
Group by
Having
Insert
Inner Join
IN
Left join
Limit
Like
MAX
MIN
Order By
OR AND
Rand
Replace
Rename Table
Select Query
Sum
Union
Update
Where
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.