After I do the add $money comes out to be 0. The data comes out as $0 and
$5,217.00, I need to add these two to get $5,217.00. How do you add money
with the dollor sign in the data?

rick

-----Original Message-----
From: Bas Jobsen [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 14, 2001 7:24 AM
To: Rick Eicher II
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] currency out of postgresql


> $formatted = sprintf("%01.2f", $money);
> printf ("<td align=\"center\">%01.2f</td></tr>\n", $formatted);

maybe twice, try:
$formatted = sprintf("%01.2f", $money);
echo "<td align=\"center\">$formatted</td></tr>\n";


----- Original Message -----
From: "Rick Eicher II" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, September 14, 2001 6:48 PM
Subject: [PHP-DB] currency out of postgresql


> I am trying to get two currency values from out of the database, add them
> together and print the to the screen. I am using the following code.
>
> $money = $myrow[6] + $myrow[7];
> $formatted = sprintf("%01.2f", $money);
> printf ("<td align=\"center\">%01.2f</td></tr>\n", $formatted);
>
> $myrow[] is the array that I load the database records into.
>
> I can echo $myrow[6] & $myrow[7], which will show like $4.00 and $4000.00.
> But when I add them together the come out as 0 every time. The columns in
> the database are of type money. This is a postgresql database.
>
> Does any one see the errors of my ways?
>
> thanks,
> Rick Eicher II
> www.pbol.net
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to