コード例 #1
0
<?php

require 'lib/Inter.php';
$Y = new Inter();
$accion = $_POST['accion'];
$cont = 0;
switch ($accion) {
    case 1:
        $verdatos = $Y->SeleccionarPacientes();
        $tabla = "<table class='table table-bordered'>\n                       <tr>\n                           <td>Nombre</td>\n                           <td>Apellido</td>\n                           <td>Edad</td>\n                           <td>Telefono</td>\n                           <td>Codigo Paciente</td>\n                       </tr>";
        foreach ($verdatos as $us) {
            $cont++;
            $tabla .= "<tr>\n                                   <td>" . utf8_encode($us['nombre']) . "</td>\n                                   <td>" . utf8_encode($us['apellido']) . "</td>\n                                   <td>" . utf8_encode($us['edad']) . "</td>\n                                   <td>" . utf8_encode($us['telefono']) . "</td>\n                                   <td>" . utf8_encode($us['codigoPaciente']) . "</td>\n                                   <td><a href=\"#\" class=\"btn-eliminar\" data-param=" . $us['IdPaciente'] . ">Eliminar</a></td>\n                                   <td><a href=\"#\" class=\"btn-editar\" data-param=" . $us['IdPaciente'] . " data-toggle=\"modal\" data-target=\".bs-example-modal-lg\">Editar</a></td>\n                               </tr>";
        }
        $tabla .= '</table>';
        if ($cont > 0) {
            echo $tabla;
        } else {
            echo 0;
        }
        break;
    case 2:
        $codigoPaciente = $_POST['code'];
        $verdatos = $Y->SeleccionarPacienteCodigo($codigoPaciente);
        $tabla = "<table class='table table-bordered'>\n                       <tr>\n                           <td>Nombre</td>\n                           <td>Apellido</td>\n                           <td>Edad</td>\n                           <td>Telefono</td>\n                           <td>Codigo Paciente</td>\n                       </tr>";
        foreach ($verdatos as $us) {
            $cont++;
            $tabla .= "<tr>\n                                   <td>" . utf8_encode($us['nombre']) . "</td>\n                                   <td>" . utf8_encode($us['apellido']) . "</td>\n                                   <td>" . utf8_encode($us['edad']) . "</td>\n                                   <td>" . utf8_encode($us['telefono']) . "</td>\n                                   <td>" . utf8_encode($us['codigoPaciente']) . "</td>\n                                   <td><a href=\"#\" class=\"btn-eliminar\" data-param=" . $us['IdPaciente'] . ">Eliminar</a></td>\n                                   <td><a href=\"#\" class=\"btn-editar\" data-param=" . $us['IdPaciente'] . " data-toggle=\"modal\" data-target=\".bs-example-modal-lg\">Editar</a></td>\n                               </tr>";
        }
        $tabla .= '</table>';
        if ($cont > 0) {