1
Good morning, I’m trying to make an Insert,plus this giving error and seems to be in the hour field,could help me identify what is wrong: Follows the Insert and the error.
INSERT INTO senhas
(senha_id,
senha_setor_id,
senha_tipo_id,
senha_numero,
senha_data,
senha_hora)
VALUES
('1',
'1',
'1',
'1',
'2016-03-01',
'10:03:00');
Follow the return:
Error Code: 1064. You have an error in your SQL syntax; check the manual that Corresponds to your Mysql server version for the right syntax to use near '' at line 14 0.000 sec
The fields are:
senha_id = int (11)
senha_setor_id = int (11)
senha_tipo_id = int (11)
senha_numero = int (11)
senha_data = date
senha_hora = time
As indicated by our colleague @jbueno were removed the '' from the int fields.
INSERT INTO senhas
(senha_id,
senha_setor_id,
senha_tipo_id,
senha_numero,
senha_data,
senha_hora)
VALUES
('',
1,
1,
1,
'2016-03-01',
'10:03:00');
Have you tested this query in phpmyadmin or Workbench? it seems that this question Sert is not the same that has been tested.
– rray
@rray You saw that the error shows a double quote (or two single quotes)
[...] syntax to use near ''
? It really seems that this is not theinsert
that is being tested.– Jéf Bueno
@jbueno the question Insert is right even with simple quotes (if the value is numerical it is converted), for me it is two single quotes together or an empty value. I also think that the problem Insert is another.
– rray
Because @rray, I had no idea that Mysql converted the values, but I tested it out of curiosity and it worked. That made me think that the
insert
problem is another...– Jéf Bueno
Checks whether Foreign Key (FK) actually exists in other tables.
– Adriano de Abreu Wanderley
You can mark the jbueno answer as accepted, the green light means the problem has been solved, if you have any questions you can see, How and why to accept an answer?
– rray