Hi guys,

Probably this is something really over discuss but would you be so kind to teach me.

I want to store prices on MySQL table, i currently have my Data Type as FLOAT with my prices on the table but it renders only the same number, what is the right Data Type for currency dollars or $ symbol.

Thank you so much

you may not necessarily see it at first, but float uses a non exact number and decimal uses exact

the currency symbol is just a matter of display, add it to your code side instead of db side

thank you dickersonka, but one last question is there a way to have this number being display dynamically with the currency symbol?

So i will only put numbers in my DB with decimals and when it renders will show it in my site with the $ symbol, without coding on a side


remember though, you can't do calculations with it, you might want to pull back the real value, and with a symbol

select columnName, concat('$', columnName) as  amount from tableName;

I am not very sure where to insert the concat function, here is my code, thank you

<?php echo $row_rsMotoDetail['product_model']; ?><br />
$<?php echo $row_rsMotoDetail['price']; ?>

use it in the select statement, not the output

why don't you just add the '$' in front of your row right here?

something like this?? is this correct? i am a newbie but a fast learner

$<?php echo $row_rsMotoDetail['$', 'price']; ?>