Jump to content


Photo

MySQL Syntax


  • Please log in to reply
3 replies to this topic

#1 puritystandsout

puritystandsout
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 13 July 2006 - 09:04 AM

Dear anyone who can help.

I am trying to execute a complex query:

$query1 = mysql_query("SELECT * FROM members WHERE (skill1 LIKE '%$select_search%' OR skill2 LIKE '%$select_search%' OR skill3 LIKE '%$select_search%) AND skill_sought1 LIKE '%web developer%'  ") or die (mysql_error());

I get this error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%web developer%'' at line 1


Any ideas?  I need to use multiple OR and one AND boolean(s)...

Many Thanks.

Regards and Jesus Christ's blessings,

Chris Cundill

#2 GingerRobot

GingerRobot
  • Staff Alumni
  • Advanced Member
  • 4,086 posts
  • LocationUK

Posted 13 July 2006 - 09:10 AM

You are missing the terminating single quote here:
OR skill3 LIKE '%$select_search%)
should be
OR skill3 LIKE '%$select_search%')

#3 puritystandsout

puritystandsout
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 13 July 2006 - 09:31 AM

Top notch reply.

Thanks again.

#4 brown2005

brown2005
  • Members
  • PipPipPip
  • Advanced Member
  • 943 posts

Posted 13 July 2006 - 09:36 AM

good spotting GingerRobot, i couldnt spot that.. lol




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users