Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/01/2013, 08:52
Avatar de andres_15_
andres_15_
 
Fecha de Ingreso: septiembre-2008
Ubicación: Cali
Mensajes: 232
Antigüedad: 15 años, 7 meses
Puntos: 7
Pregunta Hacer una consulta en php

Buen día, tengo un código el cual no me ejecuta la consulta, he intentado quitarle las comillas a $nf y tampoco, he intentado en vez de hacer un select a todo, escribir cada uno de los campos y tampoco y ya revise el nombre de la tabla y todo esta bien. ¿Que podría ser?.Muchas Gracias

Código PHP:
<?php

include("../Conexion/conexion.php");
session_start();

if (
$_POST){

    
$nf=$_POST["nf"];
}

$sql="select * from horas2 where Numero_Ficha='$nf'";

$datosmysqli_query($conexion,$sql);

?>

<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Consultar</title>
</head>
<body>
    <form>
<fieldset>

    <form action="" method="POST">
        <legend>
            Consultar
        </legend>
        
        <label for="ficha">

            Número de ficha <input type="text" name="nf">
            

        </label>

        <label for="ficha">

            <input type="submit" value="Consultar">
        </label>
    
    </form>

         <table border="2" align="center">
                <tr>
                    <td align="center">Número de ficha</td>
                    <td align="center">Fecha</td>
                    <td align="center">Empleados</td>
                    <td align="center">Entrada</td>
                    <td align="center">Salida</td>
                    <td align="center">Entrada #2</td>
                    <td align="center">Salida #2</td>
                    <td align="center">Total</td>
                    
                </tr>
            
<?php
                
                
if ($_POST){
                
$nf=$_POST["nf"];
                if (
$nf>0){
                while (
$reg mysqli_fetch_array($datos)) {

                
                
?>



                <tr>
                    <td><?php echo $reg ["Numero_Ficha"]; ?></td>
                    <td><?php echo $reg ["Fecha"]; ?></td>
                    <td><?php echo $reg ["Empleado"]; ?></td>
                    <td><?php echo $reg ["entrada"]; ?></td>
                    <td><?php echo $reg ["salida"]; ?></td>
                    <td><?php echo $reg ["Entrada2"]; ?></td>
                    <td><?php echo $reg ["Salida2"]; ?></td>
                    <td><?php echo $reg ["Total"]; ?></td>
                </tr>   

<?php
}}}
?>

</fieldset>
</body>
</head>