You can insert 8
perfectly safely into a decimal or float. It doesn't have to be 8.0
at all.
If you are having trouble inserting the value in, it isn't the data type on your database, but another issue.
If you post further detail, we will look into more :)
Edit: Here is some input data into int
, decimal
and float
types:
mysql> create table numberTest(inty int(2), decy decimal(3,2), floaty float(3,2));
Query OK, 0 rows affected (0.01 sec)
mysql> select * from numberTest;
Empty set (0.00 sec)
mysql> insert into numberTest values(7,7,7);
Query OK, 1 row affected (0.00 sec)
mysql> insert into numberTest values(7.2,7.2,7.2);
Query OK, 1 row affected (0.00 sec)
mysql> select * from numberTest;
+------+------+--------+
| inty | decy | floaty |
+------+------+--------+
| 7 | 7.00 | 7.00 |
| 7 | 7.20 | 7.20 |
+------+------+--------+
2 rows in set (0.01 sec)
If you can't insert your values, show your insert commands in PHP, it isn't the data type. You are barking up the wrong tree with this question.