<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("joshwelford", $con);
$result = mysql_query("SELECT `value` FROM `cms_settings` WHERE `id` = 'site_closed'");
$row = mysql_fetch_row($result);
$read = $row;
if($read = "eefef"){
echo "YES";
}
while($row = mysql_fetch_array($result))
{
$value = $result;
}
mysql_close($con);
?>
<?php[/FONT]
[FONT=Consolas]$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("joshwelford", $con);
$result = mysql_query("SELECT * FROM `cms_settings` WHERE `id` = 'site_closed'");
$row = mysql_fetch_row($result);
$read = $row;
if($read = "eefef"){
echo "YES";
}
while($row = mysql_fetch_array($result))
{
$value = $result;
}
mysql_close($con);
?>
<?php
$mysqli = new mysqli();
$mysqli->connect('localhost', 'root', 'PASSWORD', 'DATABASENAME');
if ($result = $mysqli->query("SELECT * FROM `cms_settings`")) {
while ($row = $result->fetch_object()) {
if($row->maintenance === "0") {
echo "NOT IN MAINTENANCE";
// header('Location: LINK TO PLACE IF MAINTENANCE IS NOT ENABLED');
}
else {
echo "IN MAINTENANCE";
// header('Location: LINK TO PLACE IF MAINTENANCE IS ENABLED');
}
}
}
?>
Try changing the 0 & 1 to yes and no?I have done exactly what you have done, tried this on multiple web servers including IIS and it still returns "In Maintenance" even when the entry is set to 0.
Sean has posted mysqli when Western is using just mysql.What Sean posted should work, if it's not, then there is something wrong on your end.
Have you changed Seans code from Mysqli to MySQL? if not, then obviously it wont workSorry you have to excuse me, I'm not great with MySQL let alone MySQLi... I changed the database etc... and added the details but that's it.