<?php date_default_timezone_set('UTC'); include '../class/ProfesionalPDO.php'; //include 'class/Profesional.php'; $pdo = new ProfesionalPDO(); echo "<h3>====== TEST insert() Profesional =====</h3>"; $unProfesional = new Profesional("aa-0001", "addd", "adad", "*****@*****.**", DateTime::createFromFormat("Y-m-d", "1987-10-23"), "Clinico", "n", 1); echo "<br>"; print_r($unProfesional); $pdo->insert($unProfesional);
<?php date_default_timezone_set('UTC'); include '../class/ProfesionalPDO.php'; //include 'class/Profesional.php'; $pdo = new ProfesionalPDO(); $lista = $pdo->getAll(); echo "<h3>====== TEST getAll() Profesionales =====</h3>"; foreach ($lista as $value) { print_r('matricula= ' . $value['matricula'] . ' '); print_r('apellido= ' . $value['apellido'] . ' '); print_r('nombres= ' . $value['nombres'] . ' '); print_r('ambito= ' . $value['ambito'] . ' '); print_r('estado= ' . $value['estado'] . ' '); print_r('email= ' . $value['email'] . ' '); echo "<br>"; }
private function updateProfesional() { if ($this->get_request_method() != "POST") { $this->response('', 406); } $fechaMatriculacion = DateTime::createFromFormat("d/m/Y", $this->_request['fechaMatriculacion']); $profesional = new profesional($this->_request['matricula'], $this->_request['apellido'], $this->_request['nombres'], $this->_request['email'], $fechaMatriculacion, $this->_request['tipoProfesion'], $this->_request['ambito'], $this->_request['estado']); $pdoProfesionales = new ProfesionalPDO(); $rowsAfected = 0; $rowsAfected = $pdoProfesionales->update($profesional); //retorno resultado operacion if ($rowsAfected == 1) { $result = array('status' => "Success", "msg" => "El Profesional ha sido MODIFICADO Correctamente"); $this->response($this->json($result), 200); } else { $result = array('status' => "error", "msg" => "Error, no one record afected."); $this->response($this->json($result), 200); } }
<?php include "../class/ProfesionalPDO.php"; $pdo = new ProfesionalPDO(); $unProfesional = new Profesional("aa-0009", "addd", "adad", "*****@*****.**", DateTime::createFromFormat("Y-m-d", "1987-10-23"), "Clinico", "n", 1); $pdo->delete($unProfesional);
<?php date_default_timezone_set('UTC'); include '../class/ProfesionalPDO.php'; //include 'class/Profesional.php'; $pdo = new ProfesionalPDO(); echo "<h3>====== TEST update() Profesional =====</h3>"; $unProfesional = new Profesional("aa-0001", "modif", "modif", "*****@*****.**", DateTime::createFromFormat("Y-m-d", "2000-02-02"), "modif", "m", false); echo "<br>"; print_r($unProfesional); $pdo->update($unProfesional);