I saw a colleague use this to get users from a table in these conditions:
SELECT * FROM users WHERE gender ='male'
AND activated='yes'
AND date_registered BETWEEN '$date1' AND '$date2'
He said that there is a problem (it does not display any lines when it was placed there AND activated='yes', but the MySQL error was not selected.
Can't you do it? Do you need to put it in brackets or something crazy to tie BETWEENand AND?
Dates are in the correct format, by the way.
source
share