SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Php And Sql

  1. #1
    SitePoint Zealot Fizlar's Avatar
    Join Date
    Aug 2003
    Location
    Sheffield
    Posts
    179
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Php And Sql

    You have an error in your SQL syntax near 'Resource id #2' at line 1

    THIS IS THE ERROR I AM GETTING

    MY SQL STATEMENT IS AS FOLLOWS

    $result = mysql_query ("SELECT * FROM COURSE_MENU, COURSES WHERE ALTERNATIVE_PHRASE_ID ='$id' AND COURSE_MENU.COURSE2_ID =COURSES.COURSE_ID AND COURSE_MENU.COURSE1_ID =COURSES.COURSE_ID AND COURSE_MENU.COURSE3_ID =COURSES.COURSE_ID AND COURSE_MENU.COURSE4_ID =COURSES.COURSE_ID AND COURSE_MENU.COURSE5_ID =COURSES.COURSE_ID AND COURSE_MENU.COURSE6_ID =COURSES.COURSE_ID AND COURSE_MENU.COURSE7_ID =COURSES.COURSE_ID;");

    WHAT IS WRONG WITH IT

    I TRIED IT IN MYSQL... IT WENT THROUGH ALRIGHT BUT NOTHING GOT RETRIEVED IT JUST SAID EMPTY SET

    I DONT UNDERSTAND!

    CAN SOMEONE HELP

    IF U NEED TO SEE THE TABLES I CAN POST IT

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,251
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    you're saying that all 7 course ids in a single COURSE_MENU row have to equal the course id in the COURSE row

    that doesn't sound right -- who chooses the same course 7 times?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Zealot Fizlar's Avatar
    Join Date
    Aug 2003
    Location
    Sheffield
    Posts
    179
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh.... in the course_menu table their are up to seven different course codes each course code relates to courses in the course menu

    what i want to say when the alternative_phrase matches the one in the course_menu i want all the course codes (up to seven) in that line to match up with its corresponding course code in the course menu

    how can i write that?

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,251
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    okay, let's continue this in the other thread:
    http://www.sitepointforums.com/showt...hreadid=129694


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
  •