SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2001
    Location
    UK
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    help with sql query please

    PHP Code:
    $result  mysql_query("SELECT courses.Course_Name, courses.CourseID, tees.Tee, tees.TeeID FROM my_courses LEFT JOIN my_holes ON my_holes.CourseID = my_courses.CourseID LEFT JOIN tees ON my_holes.TeeID = tees.TeeID LEFT JOIN courses ON my_courses.CourseID = courses.CourseID WHERE my_holes.MemberID = $MemberID"); 
    I can't work out why it's selecting everything in the my_holes table, when it should only be selecting rows with matching MemberID?

    Could anyone help please?

    Thanks

  2. #2
    SitePoint Evangelist chiphunt1's Avatar
    Join Date
    Oct 2003
    Location
    louisville, ky
    Posts
    436
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    WHERE my_holes.MemberID = '$MemberID' . Not sure if this is your problem, but I always have to put single quotes around the variable, so try '$MemberID' and see if that works

  3. #3
    SitePoint Zealot
    Join Date
    Nov 2001
    Location
    UK
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks, but that's not it. I'm pretty sure there's nothing wrong with it, It's just not doing what i want!

  4. #4
    SitePoint Addict battra's Avatar
    Join Date
    Oct 2004
    Location
    Asylum
    Posts
    277
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What's the value of $MemberID? Try to echo the query and see if it's correct.


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
  •