2 回答
TA贡献1772条经验 获得超8个赞
我在第14行发现了问题
而($行= $查询- > FETCH_ASSOC())$结果[array_shift($行)] = $行;
<?php
$conn = new mysqli($dbhost, $dbusername, $dbpassword, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
function get_all_records($sql){
global $conn;
$query = $conn->query($sql);
$result = [];
while($row = $query->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);
?>
- 2 回答
- 0 关注
- 167 浏览
添加回答
举报