Forum Moderators: coopster

Message Too Old, No Replies

Addition question

         

transmutated

7:11 pm on Mar 14, 2006 (gmt 0)

10+ Year Member



So, I run a query on a page and I need to add all the values up in one field. Not count the rows, but the actual stored values from the database. How does on go about doing that. I understand adding a value to just one of the results... but am I unsure of how to add all the results together. Thanks

henry0

8:12 pm on Mar 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Look Here [us2.php.net]

and look There [us2.php.net]

coopster

12:53 am on Mar 15, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Or are you referring to the SUM() aggregate function? It reads through rows in a database and sums up the values of the column you specify.

transmutated

1:43 am on Mar 15, 2006 (gmt 0)

10+ Year Member



Coopster is right with what I am trying to do. So, there we go... how do I sum a column of values.

transmutated

1:56 am on Mar 15, 2006 (gmt 0)

10+ Year Member



Silly me, to do that... it is actually carried out in the query and then printed back back somewhere in the page:) Thanks for the help

For reference...
[dev.mysql.com...]

[edited by: coopster at 2:01 pm (utc) on Mar. 15, 2006]
[edit reason] chnaged to authoritative reference [/edit]

transmutated

3:37 am on Mar 15, 2006 (gmt 0)

10+ Year Member



All right, now its on to the next thing... I am working on two pages, the first is just a simple form that will inform the next page as to how many of the same form it needs to generate to satisfy the number entered on the first page. I tried the

str_repeat("string", number)

but couldnt get it to go. I posted the data from the form on page 1 to page 2 and instead of using a number I used echo $_POST['formvalue'] or something of that nature to insert the number but the "number field doesnt do any thing else other then a number, which makes since. So, how is it done. How can generate the same form "x" amount of times to update the same table how ever many times a form is generate. Noob here:)