Jump to content


Photo

Searching a mySQL table using multiple criteria


  • Please log in to reply
1 reply to this topic

#1 seidanis

seidanis
  • Members
  • Pip
  • Newbie
  • 4 posts
  • LocationAthens, Greece

Posted 20 January 2003 - 02:55 AM

Here\'s the story:

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

[quote]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][/quote]

However, the following query does not seem to work:

[quote]\"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
Alex Seidanis

#2 seidanis

seidanis
  • Members
  • Pip
  • Newbie
  • 4 posts
  • LocationAthens, Greece

Posted 20 January 2003 - 05:22 AM

OK, I got it.
I had a tiny typo in the query: end=>\'$datenow\'
Alex Seidanis




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users