splitting string from database

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux