usadarts Posted February 19, 2008 Share Posted February 19, 2008 Hello All, I have a field within a database that is set as a text field. When outputting, I want to force in comma's when needed. I do not need decimal positions. Do I have to convert this to a numeric field first? How would I go about doing this without changing the field attributes in the database itself? David Link to comment https://forums.phpfreaks.com/topic/91927-change-from-text-to-numberic/ Share on other sites More sharing options...
duclet Posted February 19, 2008 Share Posted February 19, 2008 Take a look at the function number_format. It should be able to do the trick: http://us2.php.net/manual/en/function.number-format.php Link to comment https://forums.phpfreaks.com/topic/91927-change-from-text-to-numberic/#findComment-470730 Share on other sites More sharing options...
kenrbnsn Posted February 19, 2008 Share Posted February 19, 2008 Look at the number_format() function. Ken Link to comment https://forums.phpfreaks.com/topic/91927-change-from-text-to-numberic/#findComment-470731 Share on other sites More sharing options...
usadarts Posted February 19, 2008 Author Share Posted February 19, 2008 Duh....that was easy. Thank you Link to comment https://forums.phpfreaks.com/topic/91927-change-from-text-to-numberic/#findComment-470835 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.