0

INSERT into tbl_inquiry (name,phone,email,subject,message) values ('apoorva','000012345','email@email.com','subject','hi what's up')

5
Contributors
4
Replies
30
Views
3 Years
Discussion Span
Last Post by chocolatte.lavista_1
0

Thats because of 'hi what's up'. It contains single quotes, '.You must escape ' or use double quotes.
like

using double quotes instead of single quote or vice versa if there is any one of them only in your data

INSERT INTO tbl_inquiry( name, phone, email, subject, message )
VALUES (
'apoorva', '000012345', 'email@email.com', 'subject', "hi what's up"  )

OR
using escape symbol

INSERT INTO tbl_inquiry( name, phone, email, subject, message )
VALUES (
'apoorva', '000012345', 'email@email.com', 'subject', 'hi what\'s up'
)
0

The reason why you can’t insert you input such as “hi what’s up” is because you used a single quote (‘hi what’s up’). Whenever you will use a single quote for your input, you need to use double quote (“hi what’s up”) because if not, the computer will think that the single quote you used for the word “what’s” is the partner of you first single quote that signifies your input and it will look for another partner for the left single quote and if it found nothing, that will result into a syntax error just like what happened to you.

Use:

INSERT into  tbl_inquiry (name,phone,email,subject,message) values ('apoorva', '000012345', 'email@email.com', 'subject', 'hi what's up');

Edited by pritaeas: Added markdown.

0

example : INSERT into tbl_inquiry (name,phone,email,subject,message) VALUES ('apoorva', '000012345', 'email@email.com', 'subject', "hi what's up")

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.