[Solved] bind_param for php pdo for select


I rectified that above and got error on below
public function getAllRecord($table){

    $result = $this->con->prepare("SELECT * FROM ".$table);
    $result->execute();
    $results = $result->fetchAll();
    $rows = array();
    if ($results->rowCount > 0) {
        while($row = $results->fetch(PDO::FETCH_ASSOC)){
            $rows[] = $row;
        }
        return $rows;
    }
    return "NO_DATA";
}

Error:Notice: Trying to get property of non-object in C:\xampp\htdocs\inv_project\public_html\includes\DBOperation.php on line 68

solved bind_param for php pdo for select