Hello, I have the following code in my dao.php.
public function insert(){
$this->conn->beginTransaction();
try {
$sql = "QUERY DO INSERT AQUI .......";
$stmt = $this->conn->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL));
$stmt->execute();
$this->conn->commit();
} catch (Exception $e) {
$this->conn->rollback();
}
}
In my controller:
public function insert(){
$dao = new DAO($this->conn);
return $dao->insert();
}
Here I call the insert class in my view to execute the insert.
$class = new Controller($conn);
//Insert
$class->insert();
Now the question, how do I do to validate this call? If it is executed it will show a message if no other is shown. Do I do this in my view or dao? It is like ? Thank you.