homepage Welcome to WebmasterWorld Guest from 23.22.173.58
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

    
SQL - can't see the error
Readie

WebmasterWorld Senior Member



 
Msg#: 4135017 posted 12:23 am on May 19, 2010 (gmt 0)

This is probably really simple, and I'm going to kick myself for not seeing it, but hey.

I'm trying to execute the following the following query:

SELECT FROM jobs
WHERE active = "1"
AND (
job_title LIKE "%one%"
OR job_title LIKE "%two%"
OR job_title LIKE "%three%"
OR description LIKE "%one%"
OR description LIKE "%two%"
OR description LIKE "%three%"
)
AND salary >= "15000"
AND salary <= "20000"
AND (
region_id = "28"
OR region_id = "11"
)
AND (
industry = "38"
OR industry = "9"
OR industry = "24"
)
LIMIT 0 , 20

And MySQL is throwing this error:
#1064 - 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 'FROM jobs WHERE active = "1" AND (job_title LIKE "%one%" OR job_title LIKE "%two' at line 1

As I said, I've been staring at this thing until my eyes bleed and I can't spot my error, so I was hoping someone here could chip in if they can see it?

 

Readie

WebmasterWorld Senior Member



 
Msg#: 4135017 posted 12:35 am on May 19, 2010 (gmt 0)

Gah, I should stop working when I'm nearly falling asleep. Damn next-day deadlines.

SELECT FROM jobs

SELECT [b]columns[/b] FROM jobs

Why is it always after you've publically humiliated yourself you realise these things? :(

coopster

WebmasterWorld Administrator coopster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4135017 posted 3:04 pm on May 19, 2010 (gmt 0)

Hard to see errors through bloodied eyes :)
Glad you got it sorted.

whoisgregg

WebmasterWorld Senior Member whoisgregg us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4135017 posted 5:02 pm on May 20, 2010 (gmt 0)

Glad you got it sorted out, we've all been there. :)

Why is it always after you've publically humiliated yourself you realise these things? :(

There's a psychological effect to publishing it online -- you say to yourself, "While I wait for an answer I can think about something else." Once your subconscious mind gets ahold of it, it often finds the answer on it's own.

Readie

WebmasterWorld Senior Member



 
Msg#: 4135017 posted 12:03 pm on May 21, 2010 (gmt 0)

Aye, what I really should do is just go and do something else for 10 minutes, something mundane that takes attention but not thought.

I often find that the answer comes to me when I just give up for a few hours - but I never think of that until after it's happened :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved