Alex Pelletier
Alex Pelletier

Reputation: 5123

MySQL When Inserting Row Column Value Is The Same For Every Row

I have a mysql table for keeping track of books. When i try to enter a new book the EAN column only keeps the initial value that was inserted into the table.

MySQL table description I am using insert statements like this:

INSERT INTO `Books` (`EAN`, `ISBN13`, `ISBN10`, `ASIN`, `Title`, `author`, `imprint`, `price`) VALUES ('9781633669783','','','','[Title]','[Author]','[imprint]','');
INSERT INTO `Books` (`EAN`, `ISBN13`, `ISBN10`, `ASIN`, `Title`, `author`, `imprint`, `price`) VALUES (9781633669783,'','','','[Title]','[Author]','[imprint]','');

When I try to insert a book all of the info gets inserted correctly except for the EAN column. The EAN for every book is the same in the table but the value was not the same when I added the book.

Upvotes: 0

Views: 118

Answers (2)

mkowalski
mkowalski

Reputation: 51

Similar to the other StackOverflow answer here, it looks like your EAN values are too big for an INT field. (INT has a max value of 2,147,483,647) You might want to try switching the field to another type such as a BIGINT.

Upvotes: 1

Quixrick
Quixrick

Reputation: 3200

Can you try removing the quotes around the EAN value? Looks like you're trying to write a string to an INT column.

Upvotes: 1

Related Questions