0

I am trying to format a number column (Data type Decimal) so it displays as a percentage, example - 95%.

My MySql column is pct_list_sold and with a data type of Decimal(7,3).

So numbers in the cell are, as an example, 0.945665, 0.944905, 0.943350 and hence, displays as 0.950, 0.950 and .943

I am trying to format the numbers in PHP to 95%, 95% and 94% with the following:

<td style="text-align: right;"><?php echo round($row['$pct_list_sold'] * 100) . '%';?></td>

All the cells return a display of 0%.

I also tried the following from an example in a post here that returned an error:

<td style="text-align: right;"><?php echo round($row['$pct_list_sold'] * 100), . '%' ?></td>

0 Answers0