Jump to content

Archived

This topic is now archived and is closed to further replies.

seidanis

Searching a mySQL table using multiple criteria

Recommended Posts

Here\'s the story:

 

I need to look up entries from a table that fulfil the following criteria:

 

banner=\\\"top\\\"   [\\\"banner\\\" field is set(\'top\',\'bottom\')]

start<=date(\'U\') [\\\"start\\\" field is a unix timestamp]

end>=date(\'U\')  [\\\"end\\\" field is a unix timestamp]

 

However, the following query does not seem to work:

 

\"SELECT * FROM table WHERE banner=\'top\' AND start<=\'$datenow\' AND end>=\'$datenow\'\"

 

where $datenow=date(\'U\'). If I remove the second AND clause, it works OK. The question is: how do I look up entries in my table that fulfil the above 3 criteria?

 

Any help would be highly appreciated.

 

Alex

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.