volodymyr3131
volodymyr3131

Reputation: 345

MYSQL wrong data inserted

I have a problem with my SQL query. I'm trying to insert data into table, but it seems like it put wrong value for one column.

Here is my query:

INSERT INTO va_users_points (user_id, order_id, points_amount, points_action, points_type, admin_id_added_by, admin_id_modified_by, date_added)
VALUES ('16772', '152424', '49', '1', '2', '0', '0', '2015-04-20 12:22:03')

The problem with column points_amount. In my query, it's 49. The DATA Type of this column in MYSQL table is INT(11). But, it inserts 490 value. Why it could be?

Here is my database structure

'points_id' INT(11) NOT NULL AUTO_INCREMENT,
'user_id' INT(11) NULL DEFAULT '0',
'order_id' INT(11) NULL DEFAULT '0',
'order_item_id' INT(11) NULL DEFAULT '0',
'points_amount' INT(11) NULL DEFAULT '0',
'points_action' INT(11) NULL DEFAULT '0',
'points_type' INT(11) NULL DEFAULT '0',
'admin_id_added_by' INT(11) NULL DEFAULT '0',
'admin_id_modified_by' INT(11) NULL DEFAULT '0',
'date_added' DATETIME NULL DEFAULT NULL,
'date_modified' DATETIME NULL DEFAULT NULL

Upvotes: 0

Views: 1212

Answers (1)

Rahul
Rahul

Reputation: 77866

As I see, there is no way this situation can occur except if there is a AFTER INSERT trigger defined on this table va_users_points which is doing this manipulation behind the scene as already commented by @fancypants.

Check this fiddle (http://sqlfiddle.com/#!9/4b1fb/1) which proves that there is nothing wrong with your INSERT statement.

To check if really a trigger is defined or not use the below SQL statement

SELECT * FROM INFORMATION_SCHEMA.TRIGGERS
WHERE TRIGGER_SCHEMA='your_database_name' 
AND EVENT_OBJECT_TABLE='va_users_points';

Upvotes: 1

Related Questions