Re: currency out of postgresql
| From: | Bas Jobsen | Date: | Fri, 14 Sep 2001 14:24:25 +0000 |
| Subject: | Re: currency out of postgresql | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-12458@lists.php.net to get a copy of this message | ||
> $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" <rick@texol.net>
To: <php-db@lists.php.net>
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: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>