Fw: [PHP-DB] Simple Question, hopefully simple answer

From: Date: Fri, 08 Feb 2002 12:43:38 +0000
Subject: Fw: [PHP-DB] Simple Question, hopefully simple answer
Groups: php.db 
Request: Send a blank email to php-db+get-16668@lists.php.net to get a copy of this message
----- Original Message ----- From: "Jeroen Timmers" <jeroen@start4me.nl> To: "Kunden Admin" <kunden-admin@ias2001.de> Sent: Friday, February 08, 2002 1:04 PM Subject: Re: [PHP-DB] Simple Question, hopefully simple answer > > ----- Original Message ----- > From: "Kunden Admin" <kunden-admin@ias2001.de> > To: "Jeroen Timmers" <jeroen@start4me.nl> > Sent: Monday, October 08, 2001 11:49 AM > Subject: Re: [PHP-DB] Simple Question, hopefully simple answer > > > > I always seem to get the value "Resource id#2" as output when I use the > > following code... > > > > { > > $result = mysql_query("SELECT SUM(ACCTSESSIONTIME) AS TOTAL FROM > ACCOUNTING > > where FROM_UNIXTIME(TIME_STAMP,'%d.%m.%Y')='$filter'"); > > } > > echo $result; > > you must fetch the result > > while($row = mysql_fetch_array($result)) > echo $row[0]; > > /*or echo $row[total];*/ > > Jeroen > > > > > any help is much apreciated! > > > > Luke > > ----- Original Message ----- > > From: "Jeroen Timmers" <jeroen@start4me.nl> > > Newsgroups: php.db > > To: "Luke" <luke@ias2001.de> > > Cc: "[PHP-DB]" <php-db@lists.php.net> > > Sent: Friday, February 08, 2002 1:36 PM > > Subject: Re: [PHP-DB] Simple Question, hopefully simple answer > > > > > > > > > > ----- Original Message ----- > > > From: "Luke" <luke@ias2001.de> > > > To: <php-db@lists.php.net> > > > Sent: Monday, October 08, 2001 10:52 AM > > > Subject: [PHP-DB] Simple Question, hopefully simple answer > > > > > > > > > > In one of my mySql tables I have a colum that contains many fields of > > > > numbers. > > > > for example > > > > > > > > ------------------------ > > > > | id | Name | Age | Sex | > > > > ------------------------ > > > > |1 | Jim | 17 | m | > > > > |2 | Dave | 31 | f | > > > > |3 | Fred | 25 | m | > > > > > > > > Ok and I want to get the total value of all the ages out of the table. > > how > > > > can I get this? > > > > > > mysql_query(select sum(age) as total from table); > > > > > > maybey you need after the from table the follow rule: > > > distinc by id. > > > > > > it is not tested. > > > > > > success > > > > > > Jeroen > > > > > > > > > > > Hope someone can help. > > > > > > > > Luke > > > > > > > > > > > > > > > > -- > > > > PHP Database Mailing List (http://www.php.net/) > > > > To unsubscribe, visit: http://www.php.net/unsub.phpêqY¹dHF˜! > > > > gc}@(m > > > > > > > > > > > > > > > >

« previous php.db (#16668) next »