Re: SQL statement - date

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jacques wrote:
> How should I formulate my sql statement to create a result set of members 
> who registered between now and 7 days ago?
> 
> I have tried the following and it is obviously incorrect:
> 
> $sqlnewmembers = "Select uid, uprofilename from tblusers where udatereg 
> between (date() and date() - 7)";
> 
> Regards
> 
> Jacques 


this should work (please adjust date format to your needs):
BETWEEN
date('Y-m-d') AND  date('Y-m-d',mktime(0, 0, 0, date("m"),
date("d")-7,date("Y")))";

Regards Kyriacos

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux