splitting string from database

splitting string from database

am 04.07.2006 02:38:40 von Dave W

------=_Part_35087_14847954.1151973520310
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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:

echo "

cellpadding=\"3\">\n";
echo "\n";
for($i=0; $i<$num_rows; $i++){
$cash = mysql_result($result,$i,"cash");
echo "\n";
}
echo "
Cash
$cash

\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

------=_Part_35087_14847954.1151973520310--

Re: splitting string from database

am 04.07.2006 03:02:18 von Chris

Dave W wrote:
> 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.

http://www.php.net/number_format

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php