Table 1 (location_type_codes)
Code | Name
UCB UC Berkeley
UCD UC Davis
USM UC Merced
UCSF UC San Francisco
Table 2 (user)
Location_type_codes
UCB
UCSF
UCD
USM
<?
$campus_sql = mysql_query("SELECT location_type_codes.name FROM location_type_codes LEFT JOIN user ON location_type_codes.code = user.location_type_code");
while($row = mysql_fetch_array($campus_sql)){
echo $row['name'];
echo "<br />";
}
?>
Output:
UC Berkeley
UC Davis
UC Merced
UC San Francisco
I want to count how many users from Table 2 (user) attending uc berkeley, uc davis, and etc. ( like below). What do I need to do?
UC Berkeley (0)
UC Davis (0)
UC Merced (0)
UC San Francisco (0)
Thanks!