【发布时间】:2015-04-12 11:14:14
【问题描述】:
mysql 的简单函数
function sanatciver($id,$deger){
$result=mysql_query("select $deger from sanatci where sanatcino=$id");
$row=mysql_fetch_assoc($result);
return $row["$deger"];
}
我是 pdo 的新用户
$records = $db->select('mp3no, sanatcino')->from('mp3')->where('sanatcino', '=', $sno)->where('onay', '=', 1)->orderBy('mp3no', 'desc')->getAll();
$adet=$db->count();
foreach($records as $record) {
$mp3no = $record->mp3no;
$sanatcino = $record->sanatcino;
是我的示例页面是查询运行成功。
但我想编写简单的函数,它会在非对象上调用成员函数 query() 时出错
我的示例函数
function sanatciver($id,$deger){
$result = $db->select('$deger')->from('sanatci')->where('sanatcino', '=', $id)->get();
$xx = $result->$deger;
return $xx;
}
但它的错误,我该怎么办?
【问题讨论】: