我有一个大问题
public function get_setting($setting) {
// Prepate statement
$prepared = $this->prepare("SELECT `val` FROM `filex_settings` WHERE `setting`=?", 'get_setting');
$this->bind_param($prepared->bind_param('s', $setting), 'get_setting()');
$this->execute($prepared, 'get_setting()');
$result = $prepared->get_result();// < 5.3 PHP
$row = $result->fetch_object();
return $row->val;
}
替代方案吗?
答案 0 :(得分:1)
您可以尝试使用fetch()
代替bind_result()
。
public function get_setting($setting) {
// Prepate statement
$prepared = $this->prepare("SELECT `val` FROM `filex_settings` WHERE `setting`=?", 'get_setting');
$this->bind_param($prepared->bind_param('s', $setting), 'get_setting()');
$this->execute($prepared, 'get_setting()');
$this->bind_result($col_1,$col_2,..)
while($this->fetch())
{
return $col_n // the value which you want
}
}