开发者

How to insert `>` and `(` into MySQL?

开发者 https://www.devze.com 2023-02-20 09:55 出处:网络
I do not know where is the pro开发者_运维技巧blem that I can not insert > and ( into my MySQL database.

I do not know where is the pro开发者_运维技巧blem that I can not insert > and ( into my MySQL database.

I add a addslashes($str) but this still can leave the quote mark unescaped.

Is there any string functions that can solve my problem?


Don't use addslashes(), use...

mysql_real_escape_string()

Use it every time your interpolate outside strings into a query!

...or better still, use binded parameters with something like PDO.

By the way, there is no reason why > and ) wouldn't be inserted into your database that I can think of. They have no meaning inside of a string, unlike \.

0

精彩评论

暂无评论...
验证码 换一张
取 消