Connecting Tech Pros Worldwide Help | Site Map

Display server error

 
LinkBack Thread Tools Search this Thread
  #1  
Old June 29th, 2006, 02:15 PM
Bob Sanderson
Guest
 
Posts: n/a
Default Display server error

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, 03:35 PM
Janwillem Borleffs
Guest
 
Posts: n/a
Default 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, 03:35 PM
Janwillem Borleffs
Guest
 
Posts: n/a
Default 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, 03:35 PM
Jerry Stuckle
Guest
 
Posts: n/a
Default 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
==================
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.