RSS Forums RSS
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1457 | Replies: 2
Reply
Join Date: Jul 2005
Posts: 12
Reputation: bgharper is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
bgharper bgharper is offline Offline
Newbie Poster

Suppressing MySQL errors in header...

  #1  
Jul 14th, 2005
I'd like to suppress MySQL errors being printed in the header, so that errors can be passed back into the PHP page...

My current code is as follows:

[PHP]if ( ! mysql_connect($server, $database_username, $database_password) )
{ $error = "There was error when attempting to connect to the specified database server: ".mysql_error(); }[/PHP]

When I deliberately enter wrong a wrong server, username, or password, I continue to get errors printed at the top of the page. How do I stop this?

Thanks!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2005
Location: Kansas City, Missouri, USA
Posts: 345
Reputation: Troy is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 4
Troy's Avatar
Troy Troy is offline Offline
Posting Whiz

Re: Suppressing MySQL errors in header...

  #2  
Jul 14th, 2005
Try this:
[php]
if (! @mysql_connect($server, $database_username, $database_password)) {
$error = "There was error when attempting to connect to the
specified database server: ".mysql_error();
}
[/php]
Troy Wolf is the author of SnippetEdit. "Website editing as easy as it gets." IX Web Hosting
Reply With Quote  
Join Date: Jul 2005
Posts: 12
Reputation: bgharper is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
bgharper bgharper is offline Offline
Newbie Poster

Re: Suppressing MySQL errors in header...

  #3  
Jul 14th, 2005
Fantastic. Thanks!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 9:28 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC