Unix Technical Forum

SQL and PHP: Incorrect errorcode

This is a discussion on SQL and PHP: Incorrect errorcode within the MySQL General forum forums, part of the MySQL category; --> Hello folks, I was playing around with my PHP code that shall report any SQL error. To test this ...


Go Back   Unix Technical Forum > Database Server Software > MySQL > MySQL General forum

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 05:52 AM
=?iso-8859-1?q?J=F8rn_Dahl-Stamnes?=
 
Posts: n/a
Default SQL and PHP: Incorrect errorcode

Hello folks,

I was playing around with my PHP code that shall report any SQL error. To test
this code I made an error in a SQL query by changing the table name in the
field list to a table that did not exist.

This triggered the following error:

Error message: 'Unknown table 'q' in field list'
Error code: 1109

The error message is correct, but the problem is that the error code (returned
by mysql_errno) is not correct.
A 'perror 1109' say "Illegal error code: 1109".

It seems like the error number returned by mysql_errno is not to be trusted,
or? Any comments?

--
Jørn Dahl-Stamnes
homepage: http://www.dahl-stamnes.net/dahls/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 05:52 AM
Atle Veka
 
Posts: n/a
Default Re: SQL and PHP: Incorrect errorcode

Joern, is the client version of mysql in PHP the same as your client libs
on the server (where you run perror)? PHP is often times compiled with its
own mysql libs and you have to specifically tell PHP to build with the
system mysql libs if you want to.

Just a thought.


Atle

On Sun, 25 Feb 2007, Jørn Dahl-Stamnes wrote:

> Hello folks,
>
> I was playing around with my PHP code that shall report any SQL error. Totest
> this code I made an error in a SQL query by changing the table name in the
> field list to a table that did not exist.
>
> This triggered the following error:
>
> Error message: 'Unknown table 'q' in field list'
> Error code: 1109
>
> The error message is correct, but the problem is that the error code (returned
> by mysql_errno) is not correct.
> A 'perror 1109' say "Illegal error code: 1109".
>
> It seems like the error number returned by mysql_errno is not to be trusted,
> or? Any comments?
>
> --
> Jørn Dahl-Stamnes
> homepage: http://www.dahl-stamnes.net/dahls/
>
>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:00 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com