Correct PHP method to store special chars in MySQL DB

后端 未结 4 1510
刺人心
刺人心 2020-12-20 19:14

Using PHP, what is the best way to store special characters (like the following) in a MSQUL database, to avoid injections.

« \" \' é à ù

Th

4条回答
  •  旧时难觅i
    2020-12-20 19:41

    yes utf8 encoding...

    also you can use Prepared Statements if you are worried a lot about injections...

    http://www.linearchat.co.uk/2011/08/why-prepared-statements-in-mysql-are-a-good-thing/

    also

    http://dev.mysql.com/doc/refman/5.0/en/sql-syntax-prepared-statements.html

提交回复
热议问题