我创建了一个函数,我只需要获取单个数据由于某种原因它不起作用,我不知道是什么问题
这是我的代码
$functions->fetch_single('user_tbl', $objectID, $id, 'hidden_post');
function fetch_single($table_name = '' ,$where = '', $where2 = '',
$fetch = '', $debug=false){
$query = "SELECT * FROM $table_name WHERE $where = $where2";
if($debug){
exit($query);
}
$statement = $this->connection->prepare($query);
if($statement->execute()){
$fetch_single_data = $statement->fetchAll(PDO::FETCH_ASSOC);
return $fetch_single_data[0]['$fetch'];
}
return false;
}
function execute_query($query){
$statement = $this->connection->prepare($query);
if( $statement->execute() ){
return $statement;
}
return false;
}
它甚至没有进入 if 语句执行,我不知道是什么问题。请帮忙谢谢
慕运维8079593