Question

i have field "price" with type Decimals in my mysql database table, the value is 200000.00

but if i fetch in to my website using PHP, it always showing 0.00 i already double check and make sure my query and fetch script correct

is there a specific way to fetch decimal to php ?

This is my code

$query_price = mysql_query("SELECT * FROM `tblpricing` WHERE `relid`='2' AND `currency`='1'");
  $fetch_price = mysql_fetch_array($query_price);
  $priceun = "$fetch_price[annually]";

thank you

Was it helpful?

Solution

try this

print(number_format($price, 2));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top