私は自分でこの問題に遭遇しましたが、これが私が思いついた解決策です:
<form action="" method="post" name="submit">
<input type="date" name="begin"/>
<input type="date" name="end"/>
<input type="submit" name="submit" value="Submit"/>
</form>
<?php
error_reporting(0);
$start = strtotime($_POST['begin']);
$end = strtotime($_POST['end']);
$con=mysqli_connect("localhost","user","password","dbname");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT user, SUM(1) FROM processed WHERE `date` BETWEEN FROM_UNIXTIME($start) AND FROM_UNIXTIME($end) GROUP BY first_name ;" );
echo "<table border='1' class='data'>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Total Processed</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['first_name '] . "</td>";
echo "<td>" . $row['last_name '] . "</td>";
echo "<td>" . $row['numb'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
これがどれほど役立つかはわかりませんが、コードに厳密な値を含める代わりに、実際に必要な日付を選択できるように設定しました。