テーブルから行数を取得しようとすると、少し問題が発生します。ここ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);
しかし、それでも機能しないので、何かアイデアはありますか?
ありがとうございました。