1
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();
}
}
On my controller:
public function insert(){
$dao = new DAO($this->conn);
return $dao->insert();
}
Here I call the Insert class in my view to run the Insert.
$class = new Controller($conn);
//Insert
$class->insert();
Now the question, how do I validate is called ? If it is executed it shows one message if it is not shown another. I do this on my view or on the dao ? And how ? Thank you.