我想防止在我的codeigniter脚本上注入。我使用了Query Binding数组,但它没有取出结果......我收到了这个错误
致命错误:在C:\ xampp \ htdocs中的非对象上调用成员函数result()
代码吼叫
<php
$my = "Select * from gw_marge where amount != ? AND is_activated= ? ORDER BY RAND()";
$this->db->query($my, array(0, 1));
foreach ($my->result() as $roww)
{
$pay = $roww->amount;
$idd = $roww->id;
}
?>
<p><?php echo $pay.' &'.$idd; ?></p>
我哪里弄错了。
答案 0 :(得分:1)
更改
$this->db->query($my, array(0, 1));
foreach ($my->result() as $roww)
到
$query = $this->db->query($my, array(0, 1));
foreach ($query->result() as $roww)