RE: [PHP] code not working...help?
| From: | Dennis Gearon | Date: | Fri, 08 Oct 2004 05:05:14 +0000 |
| Subject: | RE: [PHP] code not working...help? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-198932@lists.php.net to get a copy of this message | ||
"Graham Cossey" <graham@cossey.plus.com> wrote:
<quote ------------------------------------------------------->
[snip]
[snikp] Secondly I find it easier (to read) to code my SQL statements thus: $countResult = db_query("SELECT count(*) AS msgCount FROM messages WHERE uid='$userID' AND fid='$fid' AND post_date<='$lastmonth'"); [snip] </quote -------------------------------------------------------> I find queries even easier to read when they are written like this: $countResult = db_query("SELECT count(*) AS msgCount$lastmonth = date("YmdHis", mktime(date("H"), date("i"), date("s"), date("m")-1, date("d"), date("Y"))); $countResult = db_query("SELECT count(*) AS msgCount FROM messages WHERE uid = '". $userID ."' AND fid = '". $fid ."' AND post_date <= '". $lastmonth ."'"); $countRow = db_fetch_array($countResult); im then using $countRow as my variable but it keeps returning a value of zero.
FROM messages
WHERE
uid='$userID' AND fid='$fid' AND post_date<='$lastmonth'
");
Neither PHP nor MySQL nor Postgres care about all the extra spaces.