Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

Recordset problem with mysql query

Posted 15 Aug 2006 21:10:15
1
has voted
15 Aug 2006 21:10:15 mark e posted:
Hello

(I am using DW8, php and mysql db).

In DW8 i set up a recordset to retrieve info from db based on two date ranges the user has entered in the form (post method) e.g. a "from date" and a "to date". This works fine under normal circumstances and returns the data correctly. The code i use is (all made from using recordsets, not programmed myself)

mysql_select_db($database_localdb, $localdb);
$query_Recordset1 = sprintf("SELECT id, species, Latin, rare, quantity, location, `date`, `user`, notes FROM results WHERE date BETWEEN '%s' AND '%s' ORDER BY date DESC"

The '%s' part of the queries are derived from the following: $_POST['dt1'] $_POST['dt2'] ...(dt1 and 2 being the field names where the user has entered a date in the format yyyy-mm-dd)

The files are limited to 10 per page and I have set up Recordset Navigation on the page - (tried block by block method and DW autoset up)

In an instance where more than 10 files are returned, i click to go to page 2 BUT there is no info in the table. If I then use the back button to go back, the info is still missing. It takes me using the browser back button to get back to my first page with the table with data in.

I can substitute other query strings in, like DATE_SUB(CURDATE(),INTERVAL 6 DAY) and this works fine, but not when I use the form wit hthe above - is it something to do with the "BETWEEN" clause?

Any assistance would be greatly appreciated (and aid my understanding of DW \ PHP)

Mark

Reply to this topic