splitting string from database
| From: | Dave W | Date: | Tue, 04 Jul 2006 00:38:40 +0000 |
| Subject: | splitting string from database | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-42157@lists.php.net to get a copy of this message | ||
Hi,
I am trying to take a number from a MySQL database and then split it into
different strings using a comma. It's for display a cash amount into a
table. It's stored in the database as something like 1000000 and I want for
it to display as 1,000,000 on the table. This is what I got so far:
<?php
echo "<table align=\"left\" border=\"1\" cellspacing=\"0\"
cellpadding=\"3\">\n";
echo "<tr><td><b>Cash</b></td></tr>\n";
for($i=0; $i<$num_rows; $i++){
$cash = mysql_result($result,$i,"cash");
echo "<tr><td>$cash</td></tr>\n";
}
echo "</table><br>\n";
?>
All this does is return the number. I tried using explode and split, but I
couldn't get either to work...It just kept saying Array in the cell. I also
tried strtok.
--
Dave W