Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/02/2017, 17:35
Joseph
 
Fecha de Ingreso: febrero-2003
Mensajes: 233
Antigüedad: 21 años, 2 meses
Puntos: 4
Problema al consultar INNER JOIN

Hago una consulta INNER JOIN (Código abajo), y al ejecutarlo me da el siquiente error: Notice: Trying to get property of non-object in C:\www\php\tablaHorario.php on line 9


Les agradezco de antemano la ayuda que puedan prestarme.

<?php

include "conexion.php";



$sql1= "select * from horario INNER JOIN docente ON horario.id_docente = docente.id INNER JOIN materia ON horario.id_materia= materia.id";
$query = $con->query($sql1);

if($query->num_rows>0):?> // AQUI ESTÁ EL ERROR - LÍNEA 9
<table class="table table-bordered table-hover">
<thead>
<th>Docente</th>
<th>Materia</th>

<th></th>
</thead>
<?php while ($r=$query->fetch_array()):{?>
<tr>
<td><?php echo $r["name"]; ?></td>
<td><?php echo $r["materia"]; ?></td>

<td style="width:150px;">
<a href="./editarHorario.php?id=<?php echo $r["id"];?>" class="btn btn-sm btn-warning">Editar</a>
<a href="#" id="del-<?php echo $r["id"];?>" class="btn btn-sm btn-danger">Eliminar</a>
<script>
$("#del-"+<?php echo $r["id"];?>).click(function(e){
e.preventDefault();
p = confirm("Estas seguro?");
if(p){
window.location="./eliminarHorario.php?id="+<?php echo $r["id"];?>;

}

});
<?php }?>
</script>
</td>
</tr>
<?php endwhile;?>
</table>
<?php else:?>
<p class="alert alert-warning">No hay resultados</p>
<?php endif;?>