function getMisCitas($usuario) { $mySQLi = conectar(); $mySQLi->real_query("SELECT hora, fecha, motivo FROM citas WHERE usuario LIKE '{$usuario}'"); $resultado = $mySQLi->use_result(); $misCitas = "<table><th>Hora</th><th>Fecha</th><th>Motivo</th>"; while ($fila = $resultado->fetch_assoc()) { $misCitas .= "<tr><td>" . $fila['hora'] . "</td>"; $misCitas .= "<td>" . $fila['fecha'] . "</td>"; $misCitas .= "<td>" . $fila['motivo'] . "</td></tr>"; } $misCitas .= "</table>"; $cajita = array("{usuario}" => $usuario, "{misCitas}" => $misCitas); echo getTemplateReContraTocho("misCitas", $cajita); }
} echo "motivo {$motivo}"; $usuario = $_SESSION["usuario"]; $hora = ""; $tabla = ""; $fecha = ""; if ($_SESSION["fechaMal"] != '') { list($anio, $mes, $dia) = split('[/.-]', $_SESSION["fechaMal"]); $fecha = $dia . "/" . $mes . "/" . $anio; } else { $fecha = "29/02/2016"; } $tabla = "<div class='divTabla'><table class='tabla'><th>Hora</th><th>{$fecha}</th><th>Motivo</th>"; for ($i = 8; $i < 17; $i++) { $hora = $i . ":00"; $tabla .= "<tr>"; if (getCita($fecha, $hora)->num_rows == 0) { $tabla .= "<td>" . $hora . "</td><td><input type='radio' id='si' name='reserva' value='" . $hora . "'></td>\r\n\t\t\t\t\t\t<td><select name='motivo'><option>Corte</option><option>Peinado</option><option>Tinte</option></select></td>"; } else { $tabla .= "<td>" . $hora . "</td><td><label>Reservado</label></td><td>Reservado</td>"; } $tabla .= "</tr>"; } $tabla .= "</table></div>"; if ($horaS != '') { setCita($usuario, $fecha, $horaS, $motivo); echo "<script>alert('Se ha reservado con exito!')</script>"; } $array = array("{usuario}" => $usuario, "{tabla}" => $tabla); echo getTemplateReContraTocho("cita", $array);