php - PDO escape serialised string -


Before using the PDO, is it possible to avoid the stringed string?

I 'has created some places where a material will be serial from a VVVEG editor. If someone pastes the text with text and saves it, then I get the following error because many style tags have been added:

  unserialize (): 1020 offset error 105  

I have tried to say that do not paste the word haha, although I want to make it so that it is possible that it is not the best way to do it.

I got the PDO function quote, but I'm not sure if I want this. Apart from that ceremony, I could not find any other solution. I am already using the PDO prepared statement.

I would like to know if this is possible. Thanks for trying.

I believe it is related to encoding.

You should base64_encode before saving and base64_decode is written as follows:

  $ toDatabse = base64_encode (serialize $ data)); // Save database from database $ unserialize (base64_decode ($ data)); // To avoid problems with encoding, save the database when you execute this SQL request  
  "SET NAMES 'utf8'  

Comments