In my php code request, I got some error when I put a null value in a table. The column names "number1", "number2" and "number3" are integers and can be zero.
if there is no null value, the request works
the query is similar to this
insert in the table (number 1, number 2, number 3) values (1,2,3);
but when I leave an empty value in the input form in PHP,
for example, I will not set the value for column "number 2", the query will look like this.
insert into the table (number 1, number 2, number 3) the values (1, 3);
he speaks of an error ERROR: syntax error at or near point "," SQL State: 42601
Does anyone have any ideas how to solve this?
this query will probably be the solution, but is there any other way?
insert into the table (number 1, number 2, number 3) the values (1, null, 3);
because I have so many variables and I'm a little lazy to place some conditions, for example, when this variable returns an empty value and then value = "null"