i want to select attendance details of an employee on the basis of months selected. i want to store data of each month with object name same as month. i don't understand how to assign name at run time. here is my code given below
for ($i=0; $i < $totalmonth; $i++) {
$query="SELECT attendance FROM attendance
WHERE month='$m' && year='$y' && dept='$dept' && location='$loc'";
$result = mysqli_query($connect, $query);
if(mysqli_num_rows($result) > 0)
{
$dbdata = array();
while ( $row = $result->fetch_assoc())
{
array_push($dbdata, $row);
}
}
else
{
echo 'Data Not Found';
}
echo json_encode(array('data' => $dbdata));
}