Re: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Curt Zirzow
* Thus wrote Ben C. ([EMAIL PROTECTED]): > I tried doing as you said and it returned 0. Is there another way to add up the > column? Please restart this discussion in a new thread, I have no clue what you are trying to do anymore. Give an brief example of your query and your php code and what y

Re: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Jim Lucas
"Ben C." <[EMAIL PROTECTED]> To: "Jay Blanchard" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, August 04, 2003 2:04 PM Subject: RE: Re: [PHP] Addin a column of numbers not using MySQL > Let me try and explain a little better and easier. Wha

RE: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C .
Jay, No results are returned. It is blank. > > From: "Jay Blanchard" <[EMAIL PROTECTED]> > Date: 2003/08/04 Mon PM 04:57:17 EDT > To: "Ben C." <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> > Subject: RE: Re: [PHP] Addin a column of numbers not u

RE: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C .
I want to do now is add up the values 1-5 and get 800.00. Does this help clarify? > > From: "Jay Blanchard" <[EMAIL PROTECTED]> > Date: 2003/08/04 Mon PM 04:57:17 EDT > To: "Ben C." <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> > Subject: RE

RE: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C .
<[EMAIL PROTECTED]> > Subject: RE: Re: [PHP] Addin a column of numbers not using MySQL > > [snip] > CODE Begin- > $sql_2 = "SELECT SUM(paidamount) as paid > FROM $tb_name > WHERE id = \"$id\" > "; > > $res

RE: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C .
lt;[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> > Subject: RE: Re: [PHP] Addin a column of numbers not using MySQL > > [snip] > It still returns '0'. I think we are missing something. Any other > ideas? Anyone else have any ideas? > [/snip] > > echo the SELECT

RE: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C .
lt;[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> > Subject: RE: Re: [PHP] Addin a column of numbers not using MySQL > > [snip] > It still returns '0'. I think we are missing something. Any other > ideas? Anyone else have any ideas? > [/snip] > > echo the SELECT

RE: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C .
Unsure. How would I do that? > > From: "Jay Blanchard" <[EMAIL PROTECTED]> > Date: 2003/08/04 Mon PM 04:36:15 EDT > To: "Ben C." <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> > Subject: RE: Re: [PHP] Addin a column of numbers not using MySQL >

RE: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C .
ate: 2003/08/04 Mon PM 02:16:22 EDT > To: "Ben C." <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> > Subject: RE: Re: [PHP] Addin a column of numbers not using MySQL > > [snip] > while ($row = mysql_fetch_array($result_2)) { > $paid = $row['paid']; &

RE: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C .
lt;[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> > Subject: RE: Re: [PHP] Addin a column of numbers not using MySQL > > [snip] > It still returns '0'. I think we are missing something. Any other > ideas? Anyone else have any ideas? > [/snip] > > echo the SELECT

RE: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Jay Blanchard
[snip] Unsure. How would I do that? [/snip] Ben I think that we have a communications failure. Let's start over...you wish to total a database column using php, correct? Everything that you have been shown so far will do that. Is it possible that there are no query results? If not, then we are do

RE: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Jay Blanchard
[snip] Let me try and explain a little better and easier. What I am trying to do is take a list of values and add them to get. I am getting the values from a database query. Assuming that I had the following: val_1 100.00 val_2 150.00 val_3 200.00 val_4 250.00 val_5 100.00

RE: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Jay Blanchard
[snip] When I echo the select state the id is the first of many ids that need to be added together. It is still not summing the total value of the records. [/snip] Are you looping through the id's somehow? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.ne

RE: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Jay Blanchard
[snip] I tried the code again and still returns a '0'. It looks like the while() is only looping one record at a time. It does looks like it is add all the records. Do you or anyone have any other suggestions? [/snip] D'oh! *slaps forehead*! It IS getting only one record! Dang! SELECT SUM(foo

RE: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Jay Blanchard
[snip] CODE Begin- $sql_2 = "SELECT SUM(paidamount) as paid FROM $tb_name WHERE id = \"$id\" "; $result_2 = @mysql_query($sql_2,$connection) or die(mysql_error()); while ($row = mysql_fetch_array($result_2)) { $paid = $row['paid']; } CODE En

RE: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Jay Blanchard
[snip] It still returns '0'. I think we are missing something. Any other ideas? Anyone else have any ideas? [/snip] echo the SELECT statement to make sure that $id is worth something -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Jay Blanchard
[snip] $sql_2 = "SELECT SUM(paidamount) as paid FROM $tb_name WHERE id = \"$id\" "; [/snip] Ben I would also check the query with echo"$sql_2 \n"; You may be surprised that what you get back is not what you intended. -- PHP General Mailing List (http://www.php.net/) To

RE: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Jay Blanchard
[snip] while ($row = mysql_fetch_array($result_2)) { $paid = $row['paid']; } CODE End- What I want to do from here is add up all the 'paid' figures. [/snip] while ($row = mysql_fetch_array($result_2)) { $paid = $row['paid']; $total = $total + $paid; }

Re: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C .
CODE Begin- $sql_2 = "SELECT SUM(paidamount) as paid FROM $tb_name WHERE id = \"$id\" "; $result_2 = @mysql_query($sql_2,$connection) or die(mysql_error()); while ($row = mysql_fetch_array($result_2)) { $paid = $row['paid']; } CODE End--

RE: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Jay Blanchard
[snip] I tried doing as you said and it returned 0. Is there another way to add up the column? [/snip] $sql = "SELECT foo FROM table WHERE you have conditions "; if(!($result = mysql_query($sql, $connection))){ print("MySQL reports: " . mysql_error() . "\n"); exit(); } while($row = mysql_f

Re: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C .
I tried doing as you said and it returned 0. Is there another way to add up the column? > > From: Jason Wong <[EMAIL PROTECTED]> > Date: 2003/08/04 Mon AM 04:25:13 EDT > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Addin a column of numbers not using MySQL > > On Monday 04 August 2003 15:59, Ben

Re: Re: [PHP] Addin a column of numbers not using MySQL

2003-08-04 Thread Ben C .
I tried the code you provided below but it returned 0. Is there another way I can do it? > > From: Jason Wong <[EMAIL PROTECTED]> > Date: 2003/08/04 Mon AM 04:25:13 EDT > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Addin a column of numbers not using MySQL > > On Monday 04 August 2003 15:59,