> I'm trying to get a very simple "sum" of the values in an MySQL
database
> field column. I have very little experience with PHP and SQL, but I
learn
> quickly. :) Our resident PHP expert who built the full script is
really
> busy, so I've been trying to do this myself. The farthest I could get
> from
> just reading various posts in other forums was:
>
> $SelectQuery = new Query ("SELECT SUM(GiftSubscriptions) AS GiftSubs
FROM
> Registration");
> $Result = mysql_query($SelectQuery);
> $Value = mysql_fetch_array($Result);
> echo $Value['GiftSubs'];
>
> However, I'm getting this error:
>
> Warning: mysql_fetch_array(): supplied argument is not a valid MySQL
> result
> resource
>
> Can someone tell me what's wrong with this part of the code?
You're query is failing. Use mysql_error() to find out why (probably
because you need a GROUP BY clause).
---John W. Holmes...
Amazon Wishlist: http://www.amazon.com/o/registry/3BEXC84AB3A5E
PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php