[PHP] Re: SQL statement - date
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
[PHP] Re: SQL statement - please help
Try a MySQL list. Or possibly even php-db. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHPsubmitform=Find+search+plugins signature.asc Description: OpenPGP digital signature
[PHP] Re: SQL statement
In article [EMAIL PROTECTED], [EMAIL PROTECTED] says... Hello, Im having a bit of trouble with the DATE_FORMAT function in mysql. $query = ('SELECT username, password, DATE_FORMAT(timestamp, '%d%m%y') FROM custlogon'); I know its failing because php doesnt like the quotation before the format parameters. Ive tried to fix this without any luck. Any Ideas ? DATE_FORMAT ( timestamp, ' %d%m%y ') Thanks in advance, -Dan Try $query = SELECT username, password, DATE_FORMAT(timestamp, '%d%m%y') FROM custlogon; -- Quod subigo farinam A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SQL statement
Dan J. Rychlik wrote: $query = ('SELECT username, password, DATE_FORMAT(timestamp, '%d%m%y') FROM custlogon'); Trying enclosing the whole SQL query string in double quotes. Regards, -- Ney André de Mello Zunino -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: SQL statement
Tried that, it failed. I recieve undefined index timestamp. when executing. - Original Message - From: Ney André de Mello Zunino [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 23, 2003 7:04 PM Subject: [PHP] Re: SQL statement Dan J. Rychlik wrote: $query = ('SELECT username, password, DATE_FORMAT(timestamp, '%d%m%y') FROM custlogon'); Trying enclosing the whole SQL query string in double quotes. Regards, -- Ney André de Mello Zunino -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php