where is the mistake in this syntax ?

Discussion in 'PHP' started by ramysarwat, Jul 17, 2010.

  1. #1
    when i try to run this sql query using php i get error

    SELECT * FROM links WHERE MATCH(title, desc) AGAINST ($s) limit 10

    where is the mistake here ?
     
    ramysarwat, Jul 17, 2010 IP
  2. gapz101

    gapz101 Well-Known Member

    Messages:
    524
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    150
    #2
    quote your string ('$s')
     
    gapz101, Jul 17, 2010 IP
  3. ramysarwat

    ramysarwat Peon

    Messages:
    164
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i did that but still the same problem
     
    ramysarwat, Jul 17, 2010 IP
  4. gapz101

    gapz101 Well-Known Member

    Messages:
    524
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    150
    #4
    did you add fulltext for these fields? title, desc
     
    gapz101, Jul 17, 2010 IP
  5. ramysarwat

    ramysarwat Peon

    Messages:
    164
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    yes i did and when i run this query from phpmyadmin i get this error

     
    ramysarwat, Jul 17, 2010 IP
  6. gapz101

    gapz101 Well-Known Member

    Messages:
    524
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    150
    #6
    aw, desc is a keyword, you should quote it with `desc`
     
    gapz101, Jul 17, 2010 IP
  7. ramysarwat

    ramysarwat Peon

    Messages:
    164
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    thank you very mush gapz101 that was the mistake
     
    ramysarwat, Jul 17, 2010 IP
  8. sanhit

    sanhit Peon

    Messages:
    318
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    @gapz101 thanks for the solution mate :)
     
    sanhit, Jul 17, 2010 IP