嘿,当我试图从表中获取行数时,我遇到了一个小问题,在date
哪里BETWEEN 2012-09-01 AND 2012-09-32
......
你能告诉我问题出在哪里吗?
$month = date(m);
$year = date(Y);
$day_start = '01';
$day_end = '32';
$from = $year.'-'.$month.'-'.$day_start;
$till = $year.'-'.$month.'-'.$day_end;
$result1 = $mysqli->query("SELECT COUNT(id) FROM `dreams` WHERE dream_state='dream' AND date BETWEEN $from AND $till");
$row1 = $result1->fetch_row();
$this_dream = $row1[0];
我试图将字符串转换为时间和从时间到日期,如下所示:
$from = strtotime($from);
$from = date("Y-m-d",$from);
$till = strtotime($till);
$till = date("Y-m-d",$till);
但仍然不起作用,所以有什么想法吗?
谢谢你。