global $currentTime;
$currentTime = gmdate('G:i:s', time() + (3 * 3600));
$restTime = mysql_query("SELECT `r_ofrom` , `r_oto` , `rid` , `r_status` FROM `restaurant` ");
while ($get_times = mysql_fetch_array($restTime)) {
$openFrom = $get_times['r_ofrom'];
$openTo = $get_times['r_oto'];
$restID = $get_times['rid'];
$restStatus = $get_times['r_status'];
if ($currentTime > $openFrom && $currentTime < $openTo) {
if ($restStatus == 'C')
mysql_query("update restaurant SET r_status='O' where rid='$restID'");
} else {
if ($restStatus == 'O')
mysql_query("update restaurant SET r_status='C' where rid='$restID'");
}
}
No not as VARCHAR , I 'm storing the time as TIME . ex 20:00:00