Forum Moderators: open

Message Too Old, No Replies

using 'Limit' and 'Where' in MySql

using 'Limit' and 'Where' in MySql

         

Sonnenblume

3:27 pm on Oct 17, 2006 (gmt 0)

10+ Year Member



Is this at all possible? I was trying ive wrote a pagination script using Limit, but im having difficulting allowing a user to sort the records (example, only display records after a certain date).

I thought my query would look like this

select * from adverts limit 3,7 where expireDate >= ".$date." order by expireDate desc

The query doesnt work on the mysql sql command line, and when used with php I get the following message...

Fatal error: Call to a member function fetch_assoc() on a non-object in C:\Program Files\xampp\htdocs\searchForm.php on line 121

I know its limit thats causing the problem, and as I can use them both separetly without difficulty I wondered if theres issues with using them together.

Any suggestions would be appreciated.

FalseDawn

5:49 pm on Oct 17, 2006 (gmt 0)

10+ Year Member



try:
select * from adverts where expireDate >= ".$date." order by expireDate desc limit 3,7