public function getNoteById($id) { // TODO: Implement getNoteById() method. $noteStmh = $this->db->prepare("SELECT * from Notes WHERE Id = :id"); $nid = intval($id); $noteStmh->bindParam(':id', $nid); $noteStmh->execute(); $noteStmh->setFetchMode(\PDO::FETCH_ASSOC); if ($row = $noteStmh->fetch()) { $myNotes = new Notes(); $myNotes->setSubject($row['Subject']); $myNotes->setNotes($row['Notes']); $myNotes->setAuthor($row['Author']); $myNotes->setId($row['Id']); $myNotes->setDatecr($row['Datecr']); return $myNotes; } else { return new Notes(); } // $noteList = $this->getAllNotes(); // if (array_key_exists($id, $noteList)) { // return $noteList[$id]; // } }