RE: [PHP] Supplied argument is not a valid MySQL result resource

From: Date: Tue, 03 Jun 2003 05:14:49 +0000
Subject: RE: [PHP] Supplied argument is not a valid MySQL result resource
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-149881@lists.php.net to get a copy of this message
Hi Hugh, Thanks, so far so good... no error messages. What next to get it to display the total properly? BTW, I changed "$SelectQuery" to "$TestSub" since "$SelectQuery" is used repeatedly in this script, and I figured it might conflict if I didn't use the "new Query" part. Kurosh -----Original Message----- From: Hugh Danaher [mailto:hdanaher@earthlink.net] Sent: Tuesday, June 03, 2003 12:53 AM To: Kurosh Burris Cc: php-general@lists.php.net Subject: Re: [PHP] Supplied argument is not a valid MySQL result resource try something simpler and see if it passes: $SelectQuery="SELECT SUM(GiftSubscriptions) AS GiftSubs FROM Registration"; $Result = mysql_query($SelectQuery) or die("Something died in here! ".mysql_error()); ----- Original Message ----- From: "Kurosh Burris" <kurosh@rogers.com> To: <php-general@lists.php.net> Sent: Monday, June 02, 2003 7:54 PM Subject: [PHP] Supplied argument is not a valid MySQL result resource > Hi Everyone, > > 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? > > Thanks, > Kurosh > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#149881) next »