I would like to sum the column age as shown below on my table but im not sure how to implement this.
total sum
I did the below:
if (isset($_POST['date1']) && isset($_POST['date2'])) {
$sql = "SELECT * FROM user WHERE signup_date BETWEEN '".$_POST['date1']."' AND '".$_POST['date2']."'";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
$x = 0;
while ($row = mysqli_fetch_assoc($result)) {
$output = '<tr>
<td>'.++$x.'</td>
<td>'.$row["name"].'</td>
<td>'.$row["email"].'</td>
<td>'.$row["age"].'</td>
<td>'.$row["signup_date"].'</td>
</tr>';
echo $output;
}
New contributor
Nicole Mawungwa is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.