3

I have the table:

qa_eventlog (datetime, ipaddress, userid, handle, cookieid, event, params)

And when I trying to run this query:

INSERT INTO qa_eventlog (datetime, ipaddress, userid, handle, cookieid, event, params) VALUES (NOW(), '10.88.11.123', '52', 'johnanhquan', NULL, 'q_edit', 'postid=913\ttitle=S\xe1\xbb\xb1 kh\xc3\xa1c nhau gi\xe1\xbb\xafa ROUTINES (Trans...\tcontent=Xin cho em h\xe1\xbb\x8fi s\xe1\xbb\xb1 kh\xc3\xa1c bi\xe1\xbb\x87t gi\xe1...\tformat=\ttext=Xin cho em h\xe1\xbb\x8fi s\xe1\xbb\xb1 kh\xc3\xa1c bi\xe1\xbb\x87t gi\xe1...\ttags=asql,bsql\textra=\tname=\toldquestion=array(72)\tsilent=1\toldtitle=S\xe1\xbb\xb1 kh\xc3\xa1c nhau gi\xe1\xbb\xafa ROUTINES (Trans...\toldcontent=Xin cho em h\xe1\xbb\x8fi s\xe1\xbb\xb1 kh\xc3\xa1c bi\xe1\xbb\x87t gi\xe1...\toldformat=\toldtags=asql,bsql\ttitlechanged=\tcontentchanged=\ttagschanged=')

I get an error:

PHP Question2Answer MySQL query error 1366: Incorrect string value: '\\xE1...\\x09f...' for column 'params' at row 1 - Query: INSERT INTO qa_eventlog (datetime, ipaddress, userid, handle, cookieid, event, params) VALUES (NOW(), '10.88.11.123', '52', 'johnanhquan', NULL, 'q_edit', 'postid=913\ttitle=S\xe1\xbb\xb1 kh\xc3\xa1c nhau gi\xe1\xbb\xafa ROUTINES (Trans...\tcontent=Xin cho em h\xe1\xbb\x8fi s\xe1\xbb\xb1 kh\xc3\xa1c bi\xe1\xbb\x87t gi\xe1...\tformat=\ttext=Xin cho em h\xe1\xbb\x8fi s\xe1\xbb\xb1 kh\xc3\xa1c bi\xe1\xbb\x87t gi\xe1...\ttags=asql,bsql\textra=\tname=\toldquestion=array(72)\tsilent=1\toldtitle=S\xe1\xbb\xb1 kh\xc3\xa1c nhau gi\xe1\xbb\xafa ROUTINES (Trans...\toldcontent=Xin cho em h\xe1\xbb\x8fi s\xe1\xbb\xb1 kh\xc3\xa1c bi\xe1\xbb\x87t gi\xe1...\toldformat=\toldtags=asql,bsql\ttitlechanged=\tcontentchanged=\ttagschanged=')

on my apache error log.

How can I fix it? I think I need to config MySQL collation, but I don't know exactly error. Please help!

0

1 Answer 1

1

You need to escape \ with \\ in your query.

 INSERT INTO qa_eventlog (datetime, ipaddress, userid, handle, cookieid, event, params) 
   VALUES (NOW(), '10.88.11.123', '52', 'johnanhquan', NULL, 'q_edit', 'postid=913\\ttitle=S\\xe1\\xbb\\xb1 kh\\xc3\\xa1c nhau gi\\xe1\\xbb\\xafa ROUTINES (Trans...\\tcontent=Xin cho em h\\xe1\\xbb\\x8fi s\\xe1\\xbb\\xb1 kh\\xc3\\xa1c bi\\xe1\\xbb\\x87t gi\\xe1...\\tformat=\\ttext=Xin cho em h\\xe1\\xbb\\x8fi s\\xe1\\xbb\\xb1 kh\\xc3\xa1c bi\\xe1\xbb\\x87t gi\xe1...\\ttags=asql,bsql\textra=\tname=\\toldquestion=array(72)\\tsilent=1\\toldtitle=S\\xe1\\xbb\\xb1 kh\\xc3\\xa1c nhau gi\\xe1\xbb\xafa ROUTINES (Trans...\\toldcontent=Xin cho em h\\xe1\\xbb\\x8fi s\\xe1\xbb\\xb1 kh\\xc3\\xa1c bi\\xe1\\xbb\\x87t gi\\xe1...\\toldformat=\\toldtags=asql,bsql\\ttitlechanged=\\tcontentchanged=\\ttagschanged=')

SQL FIDDLE DEMO

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.