I have created a function where I just need to fetch single data for some reason it is not working and I don't know what's the problem
here's my code
$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;
}
It's not even go inside if statement execute and I don't know what is the problem. please help thank you