G'd evening,
So I built this script and figured that I had it all figured out, styled it with css only to find out something is messed up.
The php script is set so that it retrieves a value from a mySQL database and if it is 0 the site is offline if it is 1 it is online. When it is offline it displays a div with a logo with a set of text, when it is online it displays the site. This is accomplished using an if and else setup. The problem is the div with the logo and text that is supposed to display when the site is offline is now displaying over top of the site that is supposed to display when it is online.
Here is the code
<html>
<head>
<title>Title Here</title>
<link rel="stylesheet" href="/offline/maintenance.css" type="text/css" />
</head>
<body>
<?php
// Make a MySQL Connection
mysql_connect('localhost', 'dbuser', "dbpass") or die(mysql_error());
mysql_select_db('dbname') or die(mysql_error());
// Retrieve all the data from the "example" table
$result = mysql_query('SELECT * FROM sitesettings')
or die(mysql_error());
while($row = mysql_fetch_object($result)) {
if ($row->site_on_off=='0')
echo '<div id="maintenance">
<img src="offline/logo.png" title="Logo" alt="Logo" />
<br>
<h5>
To bring our clients the best possible service from time to time we will pull our website down for maintenance and upgrades.
Thank you for your patience.
<br><br>
If this is urgent please contact us at ***-***-**** or by email.
</h5>
</div>
';
else
include("subdirectory/index.php");
}
mysql_free_result($result);
?>
</body>
</html>
As you can see what my intentions are is that if the database says the site setting is 0 - the site is offline so it displays the logo + text if the database says anything else it is to include the site which is located within a subdirectory.
Any ideas where I've gone wrong?