我在下面的陈述中做错了什么
$Sql = "SELECT DateOfInvCreated FROM invoice_list
WHERE username = '$username' AND (DateOfInvCreated >= CURDATE() AND DateOfInvCreated < CURDATE() + INTERVAL 1 DAY)";
我也试过
$date_vmd = date("Y-m-d");
$Sql = "SELECT DateOfInvCreated FROM invoice_list username = '$username' AND (DateOfInvCreated BETWEEN '$date 00:00:00' AND '$date 23:59:59)"
它给了我这个错误&#34;警告:mysqli_fetch_row()期望参数1是mysqli_result,布尔值在&#34;
中给出$Sql = "SELECT DateOfInvCreated FROM invoice_list
WHERE username = '$username' AND DATE(DateOfInvCreated) = CURDATE()";
效率较低。 第一个和第三个查询只给我一个结果,而不是很多。 我在这里错了什么? DateOfInvCreated是时间戳。 修改:我正在添加image
答案 0 :(得分:1)
使用您的第二个查询,您将错过where
子句,如下所示。
$date_vmd = date("Y-m-d");
$Sql = "SELECT DateOfInvCreated FROM invoice_list username = '$username' AND (DateOfInvCreated BETWEEN '$date 00:00:00' AND '$date 23:59:59)"
你应该尝试直接在MYSQL中运行这些查询,你可能会得到完整的结果,但你认为你只是根据你没有显示的其余代码回来了。