In my application, i send a big text as a post parameter to the server. The text is like the code below:
{"objects":[{"type":"path","originX":"center","originY":"center","left":138,"top":250.25,"width":184,"hei ght":254,"fill":null,"overlayFill":null,"stroke":{"source":"function anonymous() {\n\n var squareWidth = 10, squareDistance = 2;\n\n var patternCanvas = fabric.document.createElement('canvas');\n
patternCanvas.width = patternCanvas.height = squareWidth + squareDistance;\n var ctx = patternCanvas.getContext('2d');\n\n ctx.fillStyle = \"#005E7A\";\n ctx.fillRect(0, 0, squareWidth, squareWidth);\n\n return patternCanvas;\n
\n}","repeat":"repeat","offsetX":0,"offsetY":0},"strokeWidth":15,"strokeDashArray":null,"strokeLineCap":"round","strokeLineJoin":"round","strokeMiterLimit":10,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"selectable":true,"hasControls":true,"hasBorders":true,"hasRotatingPoint":true,"transparentCorners":true,"perPixelTargetFind":false,"shadow":null,"visible":true,"clipTo":null,"path":[["M",69.5,0],["Q",69.5,0,70,0],["Q",70.5,0,70.75,0],["Q",71,0,71.5,....
As you there are carriage returns in it. An i want to insert this text into mysql table as a blob. But it's not successfull. I think the reason is carriage returns in it because other examples without carriage returns work well.
How can i succeed to insert this kind of a text to my table?
By the way, i'm using codeigniter cart class with db session and try to keep this text as cart item option.
\n\nshould look\\n\\n2), which leaves your code vulnerable to sql injections. You should've used prepared statements to avoid this altogether. - peterm