Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 1457 | Replies: 2
![]() |
•
•
Join Date: Jul 2005
Posts: 12
Reputation:
Rep Power: 4
Solved Threads: 0
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!
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!
•
•
Join Date: Jun 2005
Location: Kansas City, Missouri, USA
Posts: 345
Reputation:
Rep Power: 4
Solved Threads: 4
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]
[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]
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)





Linear Mode