Home Ask Login Register

Developers Planet

Your answer is one click away!

Mauricio Ramirez Mendoza February 2016

Number Format with PHP to MySQL stored data

I have a problem with my inventory page (Im a nooby in PHP) I have uploaded all my inventory items but the price column in MySQL its a VARCHAR 255 I want to format with php all the data in the price column to number format I want this>> 10000 look like this>> 10,000

I actually have my code like this

 <div class='wrap'><b>Price</b><br>
     <div class='price'>$ $row[8]<br>


Alejandro Iván February 2016


<div class="wrap"><b>Price</b></div>
    <div class="price">$ <?php echo number_format( $row[8] ); ?></div>
    <br />

If you're echoing it, probably...

$formatted = number_format( $row[8] );
echo "<div class=\"wrap\"><b>Price</b></div>
        <div class=\"price\">$ {$formatted}</div>
        <br />

Post Status

Asked in February 2016
Viewed 3,165 times
Voted 4
Answered 1 times


Leave an answer

Quote of the day: live life