Database query insert failed when I try to insert parameter?

I have a table:

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

      

And when I try 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 am getting the 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=')

      

in my apache error log.

How can I fix this? I think I need to configure MySQL to do the mapping, but I don't know exactly the error. Please, help!

+3


source to share


1 answer


You need to go out \

with \\

your request.

 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

+1


source







All Articles