MySql insert binary data to db without errors

后端 未结 3 1270
夕颜
夕颜 2021-01-16 10:50

I have a problem. When I do an insert like so in php:

sql = \"INSERT INTO mytable (id, value)
VALUES (\'sds83\',\'\".$EncryptedString.\"\')\";
3条回答
  •  星月不相逢
    2021-01-16 11:19

    You need to escape your $EncryptedString. Depending on the type of MySQL connection object/functions you are using, it could be like this:

    $sql = "
        INSERT INTO mytable (id, value)
        VALUES ('sds83','" . mysql_real_escape_string($EncryptedString) . "')";
    

提交回复
热议问题