|
原生pdo可这样使用:
prepare中使用占位符,execute(array(xx,xx,xxx)),
2.2.0PHP复制代码
function _execute ($sql)
{
$sql = $this->_prep_query ($sql);
$result_id = $this->conn_id->prepare($sql);
if (is_object($result_id) && ($result = $result_id->execute()))
{
if (is_numeric(stripos($sql, 'SELECT')))
{
$this->affect_rows = count($result_id->fetchAll());
}
else
{
$this->affect_rows = $result_id->rowCount();
}
}
else
{
$this->affect_rows = 0;
$result = FALSE;
}
return $result;
} 复制代码
但3.0中在相同位置,system/database/drivers/pdo/pdo_driver下
PHP复制代码
protected function _execute($sql)
{
return $this->conn_id->query($sql);
}
复制代码
问题是---在3.0中应该怎样正确使用PDO,可以给我举个简单例子就行,实现prepare,execute(array(XX,XX,XX)).万分感谢!!
|
|