$sql=<< I want to use the above code to find the number of rows containing the same value in the DATE column in the table, but the result is 1 every time, and the number of rows that meet the requirements in the actual table is not 1. What is the problem? How can I modify it? $sql=<< I want to use the above code to find the number of rows containing the same value in the DATE column in the table, but the result is 1 every time, and the number of rows that meet the requirements in the actual table is not 1. What is the problem? How can I modify it?
The sqlite statement is no problem. The problem lies behind. By performing var_dump on the results obtained by executing fetchArray on $ret, we can find that Next time try more before asking questions, my bad WHERE DATE = $date
EOF;
$ret = $db->query($ sql);
echo "count:",$ret->numColumns();
Reply content:
WHERE DATE = $date
EOF;
$ret = $db->query($ sql);
echo "count:",$ret->numColumns();
array (size=1)
'COUNT(*)' => int 1
Therefore, we can use $arr['COUNT(* )']Output the correct result