zi
This commit is contained in:
@@ -28,6 +28,37 @@ class Alumno
|
||||
return $result > 0;
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
$db = new DB();
|
||||
$result = $db->dml(
|
||||
"update alumno set rut = ?, nombre = ? where id = ?",
|
||||
$this->rut, $this->nombre, $this->id
|
||||
);
|
||||
return $result > 0;
|
||||
}
|
||||
|
||||
public static function delete($id) {
|
||||
$db = new DB();
|
||||
error_log("id: $id");
|
||||
$result = $db->dml("delete from alumno where id = ?", $id);
|
||||
return $result > 0;
|
||||
}
|
||||
|
||||
public static function get($id) {
|
||||
$db = new DB();
|
||||
$results = $db->query("select * from alumno where id = ?", $id);
|
||||
|
||||
foreach($results as $result) {
|
||||
$alumno = new Alumno();
|
||||
$alumno->set_id($result['id']);
|
||||
$alumno->set_rut($result['rut']);
|
||||
$alumno->set_nombre($result['nombre']);
|
||||
}
|
||||
|
||||
return $alumno;
|
||||
}
|
||||
|
||||
public static function getAll() {
|
||||
$db = new DB();
|
||||
$results = $db->query("select * from alumno");
|
||||
|
||||
Reference in New Issue
Block a user