我在表中显示了使用PHP进行Mysql查询的结果。到目前为止一切顺利。
在我的计算机和其他几台计算机中,结果将输出如下:
但是某些计算机上的结果会输出如下奇怪的内容:
有些数字是重复的,有些数字是用字母写的..
脚本如下:
<?php
require_once("../includes/psl-config.php");
$link = mysqli_connect(DB_HOST, DB_USER, DB_PASS);
mysqli_select_db($link, DB_NAME);
mysqli_set_charset($link, "utf8");
$result = mysqli_query($link, "SELECT Desde , date_add(Desde, INTERVAL 6 DAY) AS Hasta, W, C,
CS, CD from ( SELECT STR_TO_DATE(CONCAT( yearweek(orders_header.created_at - INTERVAL 4 DAY) , ' Thursday'), '%X%V %W') as Desde,
WEEK(orders_header.created_at - INTERVAL 4 DAY) as W,
count(orders_header.id) as C, count(distinct `store_id`) as CS, count(distinct `dv_guy_id`) as CD
FROM `orders_header` where delivered=1 and is_canceled=0 GROUP BY STR_TO_DATE(CONCAT(
yearweek(orders_header.created_at - INTERVAL 4 DAY) , ' Thursday'), '%X%V %W')) as XX order by W
desc");
if ( mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_array($result)){
$desde=date("d/m/Y", strtotime($row[0]));
$hasta=date("d/m/Y", strtotime($row[1]));
echo '<tr>
<td class="text-center">Desde: '.$desde.' .. Hasta: '.$hasta.'</td>
<td class="text-center" style="font-size:20px">'.$row[3].'</td>
<td class="text-center" style="font-size:20px">'.$row[4].'</td>
<td class="text-center" style="font-size:20px">'.$row[5].'</td>
</tr>';
}
}
?>
我唯一能想到的是,这与查询中日期的计算有关