Okay so I am running into an issue with my code since no matter what I change it to, it stays on the index page?
Here is my code
<?php
// Maintenance mode
$system = (mysql_query("SELECT * FROM system"));
if($system['maintenance'] == 1)
{
header('Location: /maintenance');
exit;
}
?>
I want it so if maintenance = 1 it would send you to the maintenance.php page but it doesn't can anyone help me with this? I tried,
if(!$system['maintenance'] == 1)
which works but I have this code in my maintenance.php page
<?php
$system = (mysql_query("SELECT * FROM `system`"));
if(!$system['maintenance'] == 0)
{
header('Location: /index');
exit;
}
?>
What I thought would send me back to the index page once that in the database it shows it is a 0
or that's what I want it to do. Can anyone please explain why my code isn't working?
I am a beginner php, mysql, and C++ coder / programmer so please try to explain it the easiest way possible.
I fixed it thanks to @Script47. New code and works
<?php
$system = mysql_query("SELECT * FROM system");
$results = mysql_fetch_array($system);
if($results['maintenance'] == 1)
{
header('Location: /maintenance');
exit;
}
?>
The reason I do not need an extension for maintenance is because I have it set in .htaccess to ignore them, but for everyone to know it's a php
file.