|
|
 |
Re: FN-FORUM: PHP - Resource id #5
date posted 10th January 2006 23:12
Thanks guys, managed it with the code below (thanks john). Just removed the
while statement cos it was returning a parse error. But thanks again, didnt
realise I had to handle the data before I could use it.
Thanks again
Kev
>From: Tom Allen [EMAIL REMOVED]
>Reply-To: [EMAIL REMOVED]
>To: "FN-FORUM / [EMAIL REMOVED] [EMAIL REMOVED]
>Subject: Re: FN-FORUM: PHP - Resource id #5
>Date: 10 Jan 2006 23:25:31 -0000
>
>
>Just to explain what's going on here, a mysql_query with a SELECT sql
>statement will return a resource identifier, which you then need to
>pass to one of PHP's mysql handling function such as
>mysql_fetch_object, mysql_fetch_row, mysql_fetch_array or
>mysql_result, which will all return usable data in different formats.
>
>Have a look at the online docs at www.php.net for these functions and
>see which one suits your needs.
>
>Tom
>
>On 10 Jan 2006 23:18:40 -0000, John Kyle [EMAIL REMOVED]
>wrote:
> >
> >
> > $dons = mysql_query ("SELECT SUM(donation) as sumDonation FROM
>thegame");
> > while($tmpOb = mysql_fetch_object($dons) {
> >
> > print "TOTAL DONATIONS MADE: " . $tmpOb->sumDonation;
> >
> > }
> >
> > unset($tmpOb);
> > mysql_close($dbh);
> > unset($dbh);
> >
> > Best Regards
> >
> > John
> >
> > ----- Original Message -----
> > From: "Kevin Choppin" [EMAIL REMOVED]
> > To: [EMAIL REMOVED]
> > Sent: Tuesday, January 10, 2006 11:08 PM
> > Subject: FN-FORUM: PHP - Resource id #5
> >
> >
> > >
> > > Hi folks,
> > >
> > > What am i doing wrong here? This should return the total of all the
> > > donations in the donation column. But it just returns "Resource id
>#5". I
> > > know its usually the variable, but it isnt ive already tried changing
>it.
> > > Can anyone help? Its probably right under my nose.
> > >
> > >
> > >
> > > Many Thanks
> > >
> > > Kev
> > >
> > > _________________________________________________________________
> > > Are you using the latest version of MSN Messenger? Download MSN
>Messenger
> > > 7.5 today! http://messenger.msn.co.uk
> > >
> > >
> > > --
> > > Freelancers, contractors earn more with Prosperity4
> > > Call 0870 870 4414 or visit www.prosperity4.com
> > > and benefit from Inland Revenue approved expenses today.
> > >
> > > To advertise here: http://www.freelancers.net/advertising.html
> > >
> > >
> > --
> > Freelancers, contractors earn more with Prosperity4
> > Call 0870 870 4414 or visit www.prosperity4.com
> > and benefit from Inland Revenue approved expenses today.
> >
> > To advertise here: http://www.freelancers.net/advertising.html
> >
> >
>--
>Freelancers, contractors earn more with Prosperity4
>Call 0870 870 4414 or visit www.prosperity4.com
>and benefit from Inland Revenue approved expenses today.
>
>To advertise here: http://www.freelancers.net/advertising.html
>
> |
 |
|