Jump to content


Photo

PHP Maths


  • Please log in to reply
2 replies to this topic

#1 metrostars

metrostars
  • Members
  • PipPipPip
  • Advanced Member
  • 169 posts
  • LocationNewcastle, UK

Posted 24 June 2006 - 01:04 PM

Hi,
I have recordset with a field in called hours. How can I get all of the numbers in that field added together and displayed on the page via the use of some dynamic text? Bear in mind that there are more values being added to the recordset all the time.

Thanks in advance.

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,016 posts

Posted 24 June 2006 - 01:53 PM

[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] SUM(hours) AS total FROM tablename [!--sql2--][/div][!--sql3--]
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 metrostars

metrostars
  • Members
  • PipPipPip
  • Advanced Member
  • 169 posts
  • LocationNewcastle, UK

Posted 24 June 2006 - 06:54 PM

[!--quoteo(post=387445:date=Jun 24 2006, 02:53 PM:name=Barand)--][div class=\'quotetop\']QUOTE(Barand @ Jun 24 2006, 02:53 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] SUM(hours) AS total FROM tablename [!--sql2--][/div][!--sql3--]
[/quote]

Where do you write this? In the query section of the recordset or the dynamic text?

Thanks

EDIT: Doesn't matter. Sorted.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users