New coder here trying to figure out why I am getting an error. I have been coding on Could9.io for several months and had no issues with any of my mysql coding. I am now on Codeanywhere and am getting several errors. I’m guessing they are running different mysql versions, or have different settings enabled.
Here is my code for creating the table:
CREATE TABLE tablePages (page_id varchar (150) primary key, page_parent smallint, page_ordernumber smallint, page_sets_id smallint, page_menu_id smallint);
Here is the code I am trying to execute:
INSERT INTO tablePages (page_id, page_parent, page_ordernumber, page_sets_id, page_menu_id) VALUES ('main-menu', '0', '1', '', '1');
I then get this error message:
#1366 - Incorrect integer value: ‘’ for column ‘page_sets_id’ at row 1
I basically want a null value in the 3rd column, as I have PHP code that looks for it.
If I change from 2 single quotes ‘’ to null, then it works. On cloud 9, ‘’ did record as null.
Is there anyway to make it accept 2-single quotes?
This is sort of a big issue, as all of my code for inserting data into my tables, will insert ‘’ if the field is left blank. This is now going to cause issues for all of my tables.
Edit: I have been doing some more reading, and I noted I should post the server settings:
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Apparently STRICT_TRANS_TABLES is the issue. I don’t know how to disable this, or even if I can on Codeanywhere? Anyone have any ideas about this, or should I ask the support staff at Codeanywhere how to disable this?