I have a mysql column that is a double. How would I echo it in php? Alll my other rows work example $row['something']; What I have tried with the double print getype($row['test']); echo getype($row['test']); PHP: Any suggestions I would greatly appreciate.
May I ask why you're using DOUBLE? What does it contain? Apart from that you can use PHPs number_format() or just query it directly from mysql via SELECT FORMAT(1.2345,2);
PHP is pretty user friendly. You should just be able to echo it out. What does it do that you don't like?
That is very true - I'm guessing he has values with multiple 0's and that they don't show up correctly. Hence why I asked about what was stored in the DOUBLE column. My theory is he's using DOUBLE for something he doesn't need DOUBLE for.
Again, I'd check to see if you really want DOUBLE. If this is for saving currency information (price, for instance), DOUBLE is NOT RECOMMENDED.
Actually the setup is from someone else's project that is really old. I have never used it, nor did I ever really notice it was around. I am wondering why do you say that about double? Whats the down side? Currently for alot of my other projects I use decimal 14,2 Thank you
Yeah. Decimal would be a better choice. DOUBLE is bad for currency/monetary values since it doesn't round correctly. Not necessarily a big problem, but it can quickly add up to be quite a problem after a while.