Using AND/OR mysql commands with FROM_UNIXTIME

Posted by scatteredbomb on Stack Overflow See other posts from Stack Overflow or by scatteredbomb
Published on 2011-01-15T09:43:10Z Indexed on 2011/01/15 9:53 UTC
Read the original article Hit count: 185

Filed under:

Trying to select a query in php/mysql to get "Upcoming Items" in a calendar. We store the dates in the DB as a unix time. Here's what my query looks like right now

SELECT *
FROM `calendar`
WHERE (`eventDate` > '$yesterday') 
OR (FROM_UNIXTIME(eventDate, '%m') > '$current_month' AND `$yearly` = '1')
ORDER BY `eventDate`
LIMIT 4

This is giving me an error "Unknown column '' in 'where clause'". I'm sure it has to do with my use of parenthesis (which I've never used before in a query) and the FROM_UNIXTIME command.

Can someone help me out and let me know how I've screwed this up?

Thanks!

© Stack Overflow or respective owner

Related posts about mysql