Re: code not working...help?
| From: | Matthew Sims | Date: | Thu, 07 Oct 2004 21:56:16 +0000 |
| Subject: | Re: code not working...help? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-198902@lists.php.net to get a copy of this message | ||
> Hi guys im pretty new at this and cant seem to get this going.... I want
> the
> code to query the database for the number of messages posted within the
> last
> month this is the code i have but its not working... I might even have
> it
> all wrong, can someone point me in the right direction?
>
> $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.
$countRow is returning 0 or empty?
What does print_r($countRow) show you?
Also, try running your query from the mysql prompt, substituting the PHP
with real values. See if mysql complains about your query.
--
--Matthew Sims
--<http://killermookie.org>