I have some code for load business-hours. My databas looks like
id - int(11)
day - varchar(255)
starttime - (time)
endtime - (time)
date - (date)
type - int(1)
I try to get the data with:
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
function get_all_records($sql){
global $conn;
$result = $conn->query($sql);
$result = [];
while($row = $result->fetch_assoc()) $result[array_shift($row)] = $row;
return $result;
}
$sql = "SELECT day, starttime, endtime FROM schedule WHERE type = ";
$shop_hours = array_merge(
get_all_records($sql . "0 ORDER BY id"),
get_all_records($sql . "1 and YEARWEEK('DATE') = '201915'")
);
var_dump ($shop_hours);
?>
Only what is displayed is Connected successfully
I can't see the issue :(