What is this error?, Warning: mysqli_fetch_array () expects parameter 1 to be mysqli_result, boolean given in ... error line [duplicate]

0
<table class="table table-bordered">
            <thead>
              <tr>
                <th>Clave</th>
                <th>Nombre</th>
                <th>Apellidos</th>
                <th>Formación Académica</th>
                <th>Dirección</th>
                <th>Correo</th>
                <th>Teléfono</th>
                </tr>
            </thead>
         <tbody>
    <?php
      if ($row = mysqli_fetch_array($sqlDoc)) { //linea de error fetch array
    ?>
    <tr>
      <td><?php echo $row['clave'];?></td>
      <td><?php echo $row['nombre'];?></td>
      <td><?php echo $row['apellidos'];?></td>
      <td><?php echo $row['formacion'];?></td>
      <td><?php echo $row['direccion'];?></td>
      <td><?php echo $row['correo'];?></td>
      <td><?php echo $row['telefono'];?></td>

function buscaDocente($clave)
{
global $connect;
$sqlDoc = mysqli_query($connect, "SELECT * FROM profesores WHERE clave = ".$clave);
return $sqlDoc;
}
    
asked by Armando Arellano 16.10.2016 в 23:24
source

1 answer

0

You should try to print the value of mysqli_error() since you are returning a boolean of insurance because you have an error in your query.

$sqlDoc = mysqli_query($connect, "SELECT * FROM profesores WHERE clave = ".$clave) or die(mysqli_error()); 
    
answered by 16.10.2016 в 23:54