Foros del Web » Programando para Internet » PHP »

mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in

Estas en el tema de mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in en el foro de PHP en Foros del Web. Me sale este error mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in. que podria ser. aqui les muestro el codigo Código PHP: <html> ...
  #1 (permalink)  
Antiguo 24/01/2013, 13:01
Avatar de andres_15_  
Fecha de Ingreso: septiembre-2008
Ubicación: Cali
Mensajes: 232
Antigüedad: 15 años, 7 meses
Puntos: 7
mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in

Me sale este error mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in. que podria ser. aqui les muestro el codigo

Código PHP:
<html>
<head>
<title>
</title>
</head>
<body>

    <?php

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


    if (
$_POST){

        
$id=$_POST["id"];


        
$sql="select Identificacion,FechaExpedicion from informacion where Identificación= '$id'; ";

        
$datos=mysqli_query($con,$sql);

        echo 
"$sql";
    }

    
?>

<form action="" method="POST">
    <meta http-equiv="content-type" content="text/html ; charset=utf-8">

<fieldset>
    <legend>
        Consultar Empleado
    </legend>


    Ingrese el número de identificación del empleado <input type="text" name="id">

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

<table align="center" border="5">
                <tr>
                    <td colspan="6" align="center">EMPLEADOS</td>
                </tr>
            <tr>
                <td align="center">ID</td>
                <td align="center">Fecha</td>
                
            </tr>
            <?php
                
while($reg=mysqli_fetch_array($datos))//ESTA ES LA LINA DONDE DICE QUE HAY ERROR
                
{
            
?>
            <tr>
                <td align="center" ><?php echo $reg["Identificacion"];?>    </td>
                <td align="center" ><?php echo $reg["FechaExpedicion"];?>    </td>
            
            </tr>
            <?php
                
}
            
?>
            </table>

</form>

</body>
</html>
  #2 (permalink)  
Antiguo 24/01/2013, 13:03
Avatar de zalito12  
Fecha de Ingreso: noviembre-2011
Ubicación: Coruña, España
Mensajes: 430
Antigüedad: 12 años, 5 meses
Puntos: 67
Respuesta: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean give

Esta misma mañana, la misma pregunta: http://www.forosdelweb.com/f18/error...assoc-1033692/
  #3 (permalink)  
Antiguo 24/01/2013, 13:04
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 10 meses
Puntos: 2135
Respuesta: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean give

Imprime el valor de mysqli_error() ya que si te esta regresando un boolean, es porque tienes un error en tu consulta.

Saludos.
  #4 (permalink)  
Antiguo 24/01/2013, 14:12
Avatar de andres_15_  
Fecha de Ingreso: septiembre-2008
Ubicación: Cali
Mensajes: 232
Antigüedad: 15 años, 7 meses
Puntos: 7
Respuesta: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean give

Cita:
Iniciado por GatorV Ver Mensaje
Imprime el valor de mysqli_error() ya que si te esta regresando un boolean, es porque tienes un error en tu consulta.

Saludos.
hice esto $datos=mysqli_query($con,$sql) or die(mysql_error()); y la pagina me quedo en blanco
  #5 (permalink)  
Antiguo 24/01/2013, 14:42
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 10 meses
Puntos: 2135
Respuesta: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean give

Te indique que usaras mysqli_error, no mysql_error.

Saludos.
  #6 (permalink)  
Antiguo 24/01/2013, 14:42
Avatar de zalito12  
Fecha de Ingreso: noviembre-2011
Ubicación: Coruña, España
Mensajes: 430
Antigüedad: 12 años, 5 meses
Puntos: 67
Respuesta: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean give

mysqli_error()
  #7 (permalink)  
Antiguo 24/01/2013, 14:52
Avatar de andres_15_  
Fecha de Ingreso: septiembre-2008
Ubicación: Cali
Mensajes: 232
Antigüedad: 15 años, 7 meses
Puntos: 7
Respuesta: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean give

Lo soluciono, pues tenia un codigo de otro trabajo hecho y lo hice con ese y cogio, tal vez tenia alguna cosa pequeña mala, igualmente gracias por la ayuda (Y)

Etiquetas: boolean, expects, html, mysql, parameter, select, sql
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 01:55.