I have these tables
users {id,fname,lname}
class1 {id,user_id,l1,l2,l3...}
In the class table in the l1 etc fields it can either be Present/Absent/-.
I want a php function that will select all users, find them in the class1 table, and count how many times they are present and store this.
I know its going to need at least two while loops. One for the users and one for the class.
I have started the users, but dont know how to do the class section.
$user = mysqli_query($connection, "SELECT * FROM users ORDER BY fname");
while($fetch = mysqli_fetch_array($user))
{
$uid = $fetch['id'];
// Next Query and While Loop
}