how to select data from a database using SQL PDO

  pdo, php

Am trying to select data from the database using a function and SQL PDO but am getting this error

Fatal error: Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in

please help me out somebody

public function fetchAllPastQuestion($level,$programs_code)
 $sql = "SELECT *  FROM questions_bsc_actu_sci   WHERE deleted IS NULL AND level = '$level' AND program = $programs_code";

  $stmt = $this->conn->prepare($sql);
 $result = $stmt->fetchAll(PDO::FETCH_ASSOC);

  return $result;

//calling function
if(isset($_POST['action']) && $_POST['action'] == 'fetchAllPastQuestion' ){
    $data = $cuser->fetchAllPastQuestion($clevel,$cprograms_code);
    $path = '../assets/php/';
        $output.= '<table class="table table-striped table-bordered text-center  ">
         <th class="">Action</th>
         <th class="">File Name</th>
          <th class="">File Type</th>
         <th class="">Date Uploaded</th>
        foreach ($data as $row){
            $output .='<tr >
         <td class=" "><a class="btn font-weight-bold text-success" href="user-admin/download_questions.php?id=' .$row['id']. 'class="btn font-weight-bold text-success"><span class="glyphicon glyphicon-download"></span> Download</a>
            <td>'.substr($row['filename'],0 , 30).  '</td>
            $output.= '</tbody>
                    echo $output;

        echo '<h3 class="text-center text-muted">:(No any question is posted yet </h3>';

Source: Ask PHP