Home  >  Article  >  Backend Development  >  php数据库连接时容易出错的特殊符号问题_php基础

php数据库连接时容易出错的特殊符号问题_php基础

WBOY
WBOYOriginal
2016-05-17 09:23:20823browse

应该注意的是:表名、字段名是用操作符(键盘左上角的“~”那个键上的“`”)包起来的。而VALUES后面的值则是用单引号包起来的,据说这样是一种防注入的措施。

复制代码 代码如下:

$sql="INSERT INTO `表名` (`字段1`,`字段2`) VALUES ('值1','值2')";
mysql_query($sql);
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn