I have a 2 tables:
Category
with Primary KeyID
and columnName
Employee
with Primary KeyID
and columnCategory_id
Note: Category_id
now displays ID
correctly
I want to show Name
instead of ID
for output from Employee
.
Attempt:
$categ = mysql_query("SELECT * FROM employee WHERE id = '" . $_GET['id'] . "'");
$rows = array();
while ($row = mysql_fetch_assoc($categ)) {
$website_cat = $row;
}
Category
Table:
+----+----------------+
| ID | Name |
+----+----------------+
| 23 | Manager |
| 10 | Boss |
| 14 | Worker |
| 41 | Another |
+----+----------------+
Employee
Table:
+----+----------------+
| ID | Category_id |
+----+----------------+
| 1 | Manager |
| 2 | Boss |
| 3 | Worker |
| 4 | Another |
+----+----------------+
Output:
echo $website_cat['category_id'];