I have a form which store age range of participants in a program. The area where I need help is, how can I access the age ranges, count and display it? For example:
10 - 19 years - 5 people,
20 - 29 years - 2 people etc
Here is my code for retrieving the list
<?php
try{
// get the age range from the database
$ageQuery = "SELECT ageRange FROM event WHERE eventUserName = :eventUserName ORDER BY id DESC";
$getAges = $conn->prepare($ageQuery);
$getAges->bindValue(':eventUserName', $eventusername);
$getAges->execute();
}
catch (PDOException $e)
{
$error[] = 'Invalid data supplied.';
}
?>
How can I get the result highlighted above?
"; } I have tried this and it didn't work. – papadammy Oct 28 '20 at 12:02
"; } This would have worked but each is now deprecated. – papadammy Oct 28 '20 at 12:09