Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Failed connection message won't display... 1

Status
Not open for further replies.

BFreshour

Programmer
Mar 20, 2002
84
What is wrong with the following code? When I have the database up, it connects and loads the page. However when the database is down, instead of displaying the die message; it shows a blank HTML page.

Code:
if (!($db = @ mysql_connect($dbhost, $dbuname, $dbpass)))
	die("MySQL Server appears to be down.");
 
Don't know.

This code:

Code:
<?php

if (!($db = @ mysql_connect('localhost', 'test', 'test')))
    die(&quot;MySQL Server appears to be down.&quot;);
    
print &quot;Connected&quot;;
    
?>

Will correctly print &quot;Connected&quot; or &quot;MySQL Server appears to be down&quot;, depending on whether it can connect to the server or not.

What version of PHP are you running on what platform?

Want the best answers? Ask the best questions: TANSTAAFL!
 
IIS 5.0/PHP 4.30/MySQL 4.0.10

Your statement prints 'Connected' when I have it up, but displays a blank page when the server is down.
 
I was including the wrong file. The file I was making that change to was not the one being called. The file being called was an older file that I hadn't yet added that code to.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top