On Tuesday 05 August 2003 04:01, Ben C. wrote:
> It still returns '0'. I think we are missing something. Any other ideas?
> Anyone else have any ideas?
My ideas are:
1) turn on FULL error reporting
2) print out all your variables at every step
--
Jason Wong -> Gremlins Associates -> www.gre
* 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
"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
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
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
<[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
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
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
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
>
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'];
&
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
[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
[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
[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
[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
[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
[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
[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
[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;
}
27;paid'];
}
CODE End-
What I want to do from here is add up all the 'paid' figures.
>
> From: Jason Wong <[EMAIL PROTECTED]>
> Date: 2003/08/04 Mon PM 01:55:40 EDT
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Addin a column of numbers not u
[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
On Tuesday 05 August 2003 01:21, Ben C. wrote:
> I tried the code you provided below but it returned 0. Is there another
> way I can do it?
Please post your code.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet
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
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
On Monday 04 August 2003 15:59, Ben C. wrote:
> Yes. From there I want to add all the 'a' values together using PHP.
So do it then.
$total = $total + $myrow['a'] // or something as you go through the loop
// is just one of the ways to do this
--
Jason Wong -> Gr
Yes. From there I want to add all the 'a' values together using PHP.
-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED]
Sent: Monday, August 04, 2003 12:40 AM
To: Ben C.
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Addin a column of numbers not using MySQL
D
Do you mean something like:
";
echo $myrow['a'] ."";
echo $myrow['b'] ."";
echo $myrow['c'] ."";
}
?>
Justin
On Monday, August 4, 2003, at 05:34 PM, Ben C. wrote:
How do I add a column of numbers generated through a MySQL query
without
using the SQL SUM() functi
27 matches
Mail list logo