';
}
// 将当前订单数量和总价保存到 session
$_SESSION['num_today_order'] = array(
'num' => $num_today_order,
'total_price' => $total_price_today_order
);
}
?>
= {$timestamp} AND `channel` = {$channel_id}";
$result2 = mysqli_query($con, $sql);
$orders = mysqli_fetch_array($result2)['num'];
// 累加订单数量到总数
$total_orders += $orders;
}
// 初始化渠道占比信息数组
$channel_ratios = array();
// 循环遍历渠道信息,计算每个渠道订单数量占比,并保存到数组中
mysqli_data_seek($result, 0); // 将查询结果句柄指针重置
while ($channel = mysqli_fetch_array($result)) {
$channel_id = $channel['channel_id'];
$channel_name = $channel['channel_name'];
// 查询该渠道三个月内的订单数量
$sql = "SELECT COUNT(*) as num FROM oder WHERE `time` >= {$timestamp} AND `channel` = {$channel_id}";
$result2 = mysqli_query($con, $sql);
$orders = mysqli_fetch_array($result2)['num'];
// 计算该渠道订单数量占比
$ratio = ($total_orders > 0) ? round($orders/$total_orders*100) : 0;
// 将占比信息保存到数组中
$channel_ratios[] = array('name'=>$channel_name, 'ratio'=>$ratio);
}
?>
= UNIX_TIMESTAMP('{$date}')";
$result = mysqli_query($con, $sql);
if ($result === false) {
die(mysqli_error($con)); // 如果查询出错则输出错误信息
}
$row = mysqli_fetch_assoc($result);
$jidu = $row['jidu'];
?>
query($sql);
$rows = array();
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$rows[] = $row;
}
} else {
echo "未找到匹配数据";
}
?>
全国热榜
';
echo $row['goods']; // 输出商品名
echo '';
}
?>