Forum Moderators: mack

Message Too Old, No Replies

Setting a mysql field to accept whole numbers and decimals

How do I set up a mysql field to accept numbers with decimals

         

fishmore

8:26 pm on Dec 17, 2004 (gmt 0)

10+ Year Member



I have a php form written to post html field data to a mysql database. One of the mysql fields is set as a number field to post weight data. Works fine for whole numbers like 11 or 15 but when I enter 11.5 or 15.6 it cuts off the decimal part. I am so new I squeak and do not know much about setting up number fields in mysql, which is where I think the problem to be. Any comments will be helpfull thanks...

MamaDawg

6:50 pm on Dec 18, 2004 (gmt 0)

10+ Year Member



Make sure your MySQL field is one of the types that supports decimals - DECIMAL, FLOAT or DOUBLE. (Or REAL - same as DOUBLE). Any type of INT will truncate decimal places...

fishmore

8:59 pm on Dec 18, 2004 (gmt 0)

10+ Year Member



That did it. Thank you very much. Like they say it's easy when you know how. Making a migration to a web based database has been a trip. Thanks again...Lee