Connecting Tech Pros Worldwide Help | Site Map

Display server error

  #1  
Old June 29th, 2006, 03:15 PM
Bob Sanderson
Guest
 
Posts: n/a
Is there a way, using PHP, to detect and display an error from a MySQL
server? Can I, by using error numbers or some similar method, create my own
error messages?

tia
  #2  
Old June 29th, 2006, 04:35 PM
Janwillem Borleffs
Guest
 
Posts: n/a

re: Display server error


Bob Sanderson wrote:[color=blue]
> Is there a way, using PHP, to detect and display an error from a MySQL
> server? Can I, by using error numbers or some similar method, create
> my own error messages?
>[/color]


Sure, you can suppress the error message by preprending an at sign "@" to
the mysql_* function call and get the error code from the string returned by
the mysql_error() function.

Afterwhich, you can use the list of error codes from the MySQL website to
map the error code to whatever you like.


JW


  #3  
Old June 29th, 2006, 04:35 PM
Janwillem Borleffs
Guest
 
Posts: n/a

re: Display server error


Janwillem Borleffs wrote:[color=blue]
> Sure, you can suppress the error message by preprending an at sign
> "@" to the mysql_* function call and get the error code from the
> string returned by the mysql_error() function.
>[/color]

That should be: the mysql_errno() function.


JW


  #4  
Old June 29th, 2006, 04:35 PM
Jerry Stuckle
Guest
 
Posts: n/a

re: Display server error


Bob Sanderson wrote:[color=blue]
> Is there a way, using PHP, to detect and display an error from a MySQL
> server? Can I, by using error numbers or some similar method, create my own
> error messages?
>
> tia[/color]

You can get the MySQL error number with mysql_errno() and the text with
mysql_error(). Then just display whatever text you wish.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
avoiding "server error in '/'application" error page (VBNET, Website) ton answers 3 September 18th, 2006 05:45 PM
Server error on first try, but succeeds in subsequent tries (accessing files)? Joergen Bech answers 0 November 19th, 2005 03:21 PM
HTTP/1.1 500 Internal Server Error Niranjan Roy answers 3 November 18th, 2005 03:17 PM
Microsoft VBScript runtime error '800a000b' vs HTTP 500 - Internal server error answers 10 July 19th, 2005 12:45 PM