Esempio n. 1
0
<?php

require_once 'miconexion.php';
require_once 'alumno.php';
// $_POST y $_GET son arrays con los valores que llegan
// de los formularios
if ($_POST) {
    $alumno = Alumno::buscarPorMatricula($_POST['matricula']);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Pruebas de php</title>
</head>
<body>
	<form action="pruebas.php" method="post">
		<label for="matricula">Matricula: </label>
		<input type="text" name="matricula" id="matricula">
		<button type="submit">Buscar</button>
	</form>
	<?php 
if ($_POST) {
    ?>
	<?php 
    if (!isset($alumno)) {
        ?>
	<div>
		<p>Error al ejecutar la consulta.</p>
	</div>
Esempio n. 2
0
// echo 'Nombre: '.$alumno->getNombre().'<br>';
// echo 'Correo: '.$alumno->getCorreo().'<br>';
/**************************************************/
// $a = new Alumno();
// var_dump($a);
// echo '<br>';
// var_dump($a->buscarPorMatricula('1230436'));
// echo '<br>';
// var_dump($a);
/**************************************************/
// las variables $_POST y $_GET son arreglos que reciben las
// variables enviadas desde un formulario
if ($_POST) {
    // si llegaron variables
    $alumno = new Alumno();
    $a = $alumno->buscarPorMatricula($_POST['matricula']);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Pruebas de php</title>
</head>
<body>
	<form action="prueba.php" method="post">
		<label for="matricula">Matricula:</label>
		<input type="text" name="matricula" id="matricula">
		<button type="submit">Buscar</button>
	</form>
	<?php 
Esempio n. 3
0
 public static function eliminar($matricula)
 {
     // metodo para eliminar el registro de un alumno
     $alumno = Alumno::buscarPorMatricula($matricula);
     if ($alumno) {
         $sql = sprintf("delete from alumno where matricula='%s'", $matricula);
         $cnn = new Conexion();
         $rst = $cnn->query($sql);
         $cnn->close();
         return $rst;
     } else {
         return false;
     }
 }