footer include does not show up when DB is down<

liunx

Guest
When I use a DB connection script with require_once, if the DB is down my script stops right there. I also tried include_once. This makes the page look very ugly because the footer does not render. Any ideas?Could you show us some code maybe?<?php //Header area
$pageTitle = "Title";
$rightPanel = false; //True or False for right panel display.
include('include/header.php');

echo '<h1>Current Members</h1>';

require_once ('../../mysql_connect.php');



Stops working here if mySQL is not running.<!-- m --><a class="postlink" href="http://ca3.php.net/manual/en/function.require.php">http://ca3.php.net/manual/en/function.require.php</a><!-- m -->


require() and include() are identical in every way except how they handle failure. include() produces a Warning while require() results in a Fatal Error. In other words, don't hesitate to use require() if you want a missing file to halt processing of the page. include() does not behave this way, the script will continue regardless. Be sure to have an appropriate include_path setting as well.Hmm, I wonder why include_once isn't working. I figured this, but I can't seem to get include_once to work either.Nope, still doesn't work. :(

Even with include.maybe show more code? or give an url of the result...<?php //Header area
$pageTitle = "title";
$rightPanel = false; //True or False for right panel display.
include('include/header.php');

$firstName = $_GET['fn']; // Get first and last name from URI.
$lastName= $_GET['ln'];


echo "\n<h1>$firstName $lastName</h1>";

require_once ('../../mysql_connect.php');

// Query
$query = "SELECT media, date_registered, description, web_address, email FROM members WHERE first_name = '$firstName' AND last_name = '$lastName'";
$result = @mysql_query ($query);

if ($row = mysql_fetch_array ($result)) { // Grab user info
echo"\n<p>$row[description]</p>";
echo"\n<p>email: <a href=http://www.htmlforums.com/archive/index.php/\"mailto:$row\">$row[email]</a></p>";
echo"\n<p>website: <a href=http://www.htmlforums.com/archive/index.php/\"http://$row[web_address]\">$row[web_address]</a></p>";
echo"\n<p>Media: $row[media]";
echo"\n<p>SSC Member Since: $row[date_registered]";
echo"\n";
} else { // Else no info for this user
echo 'Sorry, there is no information available for this member.';
}



//Footer area
include('include/footer.php');
?>


I've tried include and include_once also for the DB. Not a bit deal, but it would be nice if the footer would include if the DB was down.
 
Back
Top