Estoy haciendo como una especie de Web para una empresa de taxis y tengo unos cuantos problemillas. Escribo para ver si me podéis orientar un poco.
El código es el siguiente:
Código PHP:
if (isset($_POST["fecha"])) {
$conexion=mysqli_connect("localhost:3306", "root", "", "taxicorp");
$vfecha=$_POST["fecha"];
$pos=strpos($vfecha,"/");
$dia=substr($vfecha,0,$pos);
$vfecha=substr($vfecha,$pos+1,strlen($vfecha));
$pos=strpos($vfecha,"/");
$mes=substr($vfecha,0,$pos);
$anyo=substr($vfecha,$pos+1,strlen($vfecha));
$vfecha=date("Y/m/d",mktime(0,0,0,$mes,$dia,$anyo));
$sel = "SELECT * FROM servicios WHERE Día='" . $vfecha . "'";
//Ejecutamos la sentencia SQL
$exec=mysqli_query($conexion, $sel);
$result = mysqli_affected_rows($exec);
?>
Código HTML:
<table border="3"> <TR><th colspan="4" align="center">Fecha caja: <strong><?php echo($_POST["fecha"]); ?></strong></th></tr> <TD><font color="blonde"><strong>Matrícula</strong></font></TD> <TD><font color="blonde"><strong>Modelo</strong></font></TD> <TD><strong><font color="blonde">Conductor</font></strong></TD> <TD><strong><font color="blonde">Precio Carrera</font></strong></TD> </TR>
Código PHP:
<?php
$precio=0;
while ($registro=mysqli_fetch_array($exec)) {
?>
<TR>
<TD><strong><font color="#000066"><?php echo($registro["Matricula"]); ?></TD>
<TD><?php
$gmodelo = "SELECT Modelo FROM taxis WHERE Matricula='" . $registro["Matricula"] . "'";
$modeloexec=mysqli_query($conexion, $gmodelo);
echo(mysqli_free_result($modeloexec)); ?> </font></strong></TD>
<TD><?php echo($registro["Nombre"] . " " . $registro["Apellidos"]); ?></TD>
<TD><?php echo($registro["Carrera"]); $precio+=$registro["Carrera"]; ?></TD>
</TR>
<?php
}
?>
Código HTML:
<TR> <TD COLSPAN="6"> <strong><font color="#000066">Número carreras: </font></strong><strong><font color="red"><?php echo($result); ?></font></strong><strong> [COLOR="Navy"][B][I]//AQUÍ ME DA WARNING!![/I][/B][/COLOR] <font color="#000066"> - Recaudación Total carreras: </strong></font><strong><font color="green"><?php echo($precio); ?>€ </font></strong></TD> </TR> <TR>
Código PHP:
<?php
$cadena="<a href=mail.php?Fecha=". $_POST["fecha"] . "&Carreras=". $result . "&Total=" . $precio ."€>Enviar a la central</a>";
?>
Código HTML:
<TD align="center" COLSPAN="6"><?php echo($cadena); ?></TD> </TR> </TABLE>
Código PHP:
<?php
} else {
?>
Código HTML:
<form action="caja.php" method="post"> <fieldset style="width:400px"> <legend> INTRODUZCA LA FECHA: </legend> <input name="fecha" type="text" id="fecha" size="10" maxlength="10" /> <input type="submit" name="Submit" value="Ver caja del día" /> </fieldset> </form>
Código PHP:
<?php
}
?>
Código HTML:
</body> </html>
No sé si me he explicado bien, o si necesitáis más datos. Estoy bastante perdido.
Gracias de antemano.