Ver Mensaje Individual
  #1 (permalink)  
Antiguo 10/09/2015, 10:24
wilbort
 
Fecha de Ingreso: septiembre-2015
Mensajes: 1
Antigüedad: 8 años, 7 meses
Puntos: 0
Problema con codigo php

Hola gente, tengo este error, deseo su ayuda

tengo 2 paginas con el mismo código (solo usan bases de datos distintas), bueno este es lo que me bota la pagina:

Fatal error: Call to a member function fetch_assoc() on a non-object in /home/u113800298/public_html/notas-20152/obtenerPorNombre.php on line 32

y este es el código:

Código PHP:
<?php
    
require "scripts/conexion.php";
    
$conexion= new Conexion ('u113800298_no152');
    
$conexion->conectar();
    
    
$promedios=$conexion->ejecutar("SELECT P.matricula,A.nombres,A.apellidos,P.nota1,P.nota2,P.nota3,P.promedio,C.curso,C.ciclo,U.nombre FROM promedios P 
INNER JOIN alumnos A 
ON P.matricula=A.matricula 
INNER JOIN cursos C 
ON P.idCurso=C.idCurso
INNER JOIN usuarios_cursos UC
ON C.idCurso=UC.idCurso
INNER JOIN usuarios U
ON UC.usuario=U.usuario
WHERE A.nombres LIKE '%"
.$_GET['txtNombre']."%' OR A.apellidos LIKE '%".$_GET['txtNombre']."%' OR CONCAT(A.nombres,' ',A.apellidos) LIKE '%".$_GET['txtNombre']."%'");
    
$conexion->desconectar();

?>

<!DOCTYPE html>
<html>
<head>
    <title>LISTADO DE NOTAS</title>
    <!-- <link rel="stylesheet" type="text/css" href="css/estilos.css"> -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
</head>
<body>
    <?php
     
     $promedios_array 
= array();
     
     while (
$row $promedios->fetch_row()) 
        {
               
$promedios_array[] = $row;
        }
/*las lineas de arriba son las del error*/


    
?>
    <div class="row">
        <div class="col-sm-offset-2 col-md-8">
        
        <div class="page-header">
        <h1>SISTEMA DE GESTION ACADEMICA - ITM</h1>
          </div>
          <div class="panel panel-default">
              <div class="panel-body">
                    <h4>Se estan consultando las notas del alumno: <?= $promedios_array[0][2?><?= $promedios_array[0][1?></h4>
                 <h4>Matricula del alumno: <?= $promedios_array[0][0?></h4>
               </div>
        </div>
           
        </div>
    </div>
      <div class="row">
        <div class="col-sm-offset-2 col-md-8">
          <table class="table">
            <thead>
              <tr>
                <th>CURSO</th>
                <th>DOCENTE</th>
                <th>PROMEDIO</th>
                <th>UNIDAD 1</th>
                <th>UNIDAD 2</th>
                <th>UNIDAD 3</th>
                <th>MODULO</th>
              </tr>
            </thead>
            <tbody>
              
              
        <?php
            
            
foreach($promedios_array as $fila)
                echo 
"<tr><td>".$fila[7]."</td><td>".$fila[9]."</td><td>".$fila[6]."</td><td>".$fila[3]."</td><td>".$fila[4]."</td><td>".$fila[5]."</td><td>".$fila[8]."</td></tr>";
                
        
?>
              
            </tbody>
          </table>
        </div>

        <div class="row" >
             <div class="col-sm-offset-4 col-md-4">
             <a href="consultarPorNombre.html">
            <button type="button" class="btn btn-primary pull-left" >
             Volver atras
              </button>
              </a>
              </div>
          </div>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
</body>
</html>