I used this in my index.php
<?
include('config.php');
if($site->maintenance > 0){
echo "<script>document.location.href='maintenance'</script>";
exit;
}
?>
and in my config.php after checked database connection
$site = mysql_fetch_object(mysql_query("SELECT * FROM problems"));
I made a table in my database and called it problems
but even when I put the value 0, it transfers me to maintenance. When I checked the variable $site
by var_dump($site)
it outputs:
bool(false)
and if I checked it like this: var_dump($site->maintenance)
it outputs:
NULL
What do I have to do to manage the maintenance from database and when I want my site to work I change value?