Ver Mensaje Individual
  #4 (permalink)  
Antiguo 12/04/2013, 10:20
summerblack
 
Fecha de Ingreso: diciembre-2012
Mensajes: 249
Antigüedad: 11 años, 4 meses
Puntos: 2
Respuesta: Duda con mysqli_fetch_array() expects parameter 1 to be mysqli_result, boo

bueno ps esta es la clase de pedido

Código PHP:
Ver original
  1. <?php
  2. include_once("conexionmysql.php");
  3.  
  4. class Pedido{
  5.    
  6.  
  7.    
  8. //constructor
  9. function Pedido(){
  10. }
  11.  
  12.  
  13. function mostrarConsulta($busId,$busCiudad){
  14.   $sql = new Mysql;
  15.   $sql->connect();
  16.   $query = "select * from pedidos where Id = $busId and Ciudad=$busCiudad";
  17.   if($result = $sql->query($query))
  18. {
  19.    $name = mysqli_result($result,0,'name');
  20. }
  21. else
  22. {
  23.    echo($query.' '.mysqli_error());
  24. }
  25.   $sql->close();
  26. if (!$result){
  27. return false;
  28. echo ('Registro no encontrado');
  29. }
  30. else{
  31. return $result;
  32.   }
  33.   }
  34.  
  35.   }  
  36.  
  37.    
  38.  
  39. ?>


Código PHP:
Ver original
  1. include_once("pedido.php");
  2.  
  3. $p=new Pedido;
  4. $busId = 33;
  5. $busCiudad = 'Medellin';
  6. $lista= $p->mostrarConsulta($busId,$busCiudad);
  7. ?>
  8.  
  9. <table style="border:1px solid #ccc; color:#000;width:800px;">
  10. <tr style="background:#3399FF;">
  11. <td>Pedido No.</td>
  12. <td>Ciudad<br/></td>
  13. <td>Fecha </td>
  14. <td>Encargado</td>
  15. <td>Observaciones</td>
  16. <td>Generar PDF</td>
  17. </tr>
  18. <?php
  19.  while($row = mysqli_fetch_array($lista)){
  20.   echo "<tr>";
  21.   echo "<td>".$row['Id']."</td>";
  22.   echo "<td>".$row['Ciudad']."</td>";
  23.   echo "<td>".$row['Fecha']."</td>";
  24.   echo "<td>".$row['Nombres']."</td>";
  25.     echo "<td>".$row['Observaciones']."</td>";
  26.   echo "</tr>";
  27.  }
  28. ?>
  29. </table>

y me bota el siguiente error y no se que pueda ser, creo q el problema radica en la variable $lista o no se muy bn, quien me pueda ayudar gracias

Warning: mysqli_error() expects exactly 1 parameter, 0 given in D:\Apache\htdocs\......pedido.php on line 87
select * from pedidos where Id= 33 and Ciudad=Medellin
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in D:\Apache\htdocs\............\busqueda.php on line 21