Results 1 to 2 of 2

Thread: php accessing database field

  1. #1
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default php accessing database field

    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?

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

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Quote Originally Posted by pissa View Post
    Code:
    $query = "SELECT * FROM 'Department' WHERE 'boss = {$boss}'";
    The above should actually look something like this:

    Code:
    $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.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •