//创建表模型
$news_table=new news();
//创建相应的适配器
$db=$news_table->getAdapter();
//准备好sql语句
$sql=$db->quoteInto("select title,pubDate from news where title like '%$keyword_arr[0]%'");
//获取结果集
$res=$db->query($sql)->fetchAll();
我需要模糊查询,有意要带%号,而且里面还有变量名$号,数组的下标运算符[]号,但又要防止别人用%之类的这些东西来Sql注入,这句话该怎么写啊??
$news_table=new news();
//创建相应的适配器
$db=$news_table->getAdapter();
//准备好sql语句
$sql=$db->quoteInto("select title,pubDate from news where title like '%$keyword_arr[0]%'");
//获取结果集
$res=$db->query($sql)->fetchAll();
我需要模糊查询,有意要带%号,而且里面还有变量名$号,数组的下标运算符[]号,但又要防止别人用%之类的这些东西来Sql注入,这句话该怎么写啊??
不过mysql_real_escape_string不转义 % 和 _ 所以可以先 str_replace(),去掉不想要的符号。
我是菜鸟啊
PHP Warning: Missing argument 2 for Zend_Db_Adapter_Abstract::quoteInto(),
called in E:\myenv\Apache\htdocs\news\application\controllers\NewsqueryController.php on line 44 and defined in E:\myenv\Apache\htdocs\news\library\Zend\Db\Adapter\Abstract.php on line 927PHP Notice: Undefined variable: value in
E:\myenv\Apache\htdocs\news\library\Zend\Db\Adapter\Abstract.php
on line 930
不晓得哪里有问题
2、PHP Notice: Undefined variable: value
$value 没有定义,在 Abstract.php 930 行
和
mysql_escape_string有什么分别??
方法 quoteInto 需要有两个参数to #7
后者已列入过时系列