Log in

View Full Version : php accessing database field



boogyman
03-22-2007, 03:04 PM
In my database I have "employees" as records, and in the record I have a field for "boss". some of my employees have multi bosses, and yet others have multi bosses and multiple employees

I was wondering how to structure it so that when I reference 1 boss I get the employee's of just that boss, without skipping any of the employees that have multiple bosses?


$query = "SELECT * FROM 'Department' WHERE 'boss = {$boss}'";

thetestingsite
03-22-2007, 04:13 PM
$query = "SELECT * FROM 'Department' WHERE 'boss = {$boss}'";

The above should actually look something like this:



$query = "SELECT * FROM `Department` WHERE `boss`= '$boss'";


Other than that, without more detail as to how your database structure is, that should do it.

Hope this helps.