Hello all,
i have this code that shows the department categories in a 4 column format, my problem is how do i insert the names of the people that belong to that category to be shown under the category name? i have 2 tables, one is the department categories and the other one is users, under users there is a field that is called staff_department..here is the code that shows the categories only;
$sqlCat = MySQL_Query("SELECT dep_name FROM staff_departments ORDER BY dep_name");
$columns = 4;
$numRows = MySQL_Num_Rows ($sqlCat);
$rows = ceil($numRows / $columns);
while($category = MySQL_Fetch_Array($sqlCat)) {
$cat[] = $category['dep_name'];
}
echo '<br><br>'.
'<table cellpadding="0" cellspacing="0" align="center" width="100%" border="1">';
for($i = 0; $i < $rows; $i++) {
echo '<tr>';
for($j = 0; $j < $columns; $j++) {
if(isset($cat[$i + ($j * $rows)])) {
echo '<td><strong>'. $cat[$i + ($j * $rows)] . '</strong></td>';
}
}
echo '</tr>';
}
echo '</table>';
i guess im missing a query to show the names under the category example SELECT * FROM users WHERE staff_department = '$sqlCat [dep_name]' but where do i do this?
thanks to all in advance 🙂