Most likely explanation for this behavior is that the column is defined as datatype
DECIMAL(5,2), which allows for only three digits before the decimal point. And the error/warning is being ignored.
The value being stored in the column the maximum value that can be stored in that datatype. We observe similar behavior with integer values as well.
create table foo (col52 DECIMAL(5,2), col72 decimal(7,2)); insert ignore into foo (col52, col72) values (1234.56, 1234.56); select * from foo; col52 col72 ------ ------- 999.99 1234.56
On an entirely different note, the code appears to be vulnerable to SQL injection.
TRUNCATE TABLE statement is a prepared statement, but the
INSERT is not.
$sql = 'INSERT INTO `inv_price` (sku, part_status, msrp, curr_sugg_retail, your_price) VALUES (?, ?, ?, ?, ?)'; $sth=conn->prepare($sql); $sth->bindParam(1,$id); $sth->bindParam(2,$data); $sth->bindParam(3,$data); $sth->bindParam(4,$data); $sth->bindParam(5,$data); $sth->execute();