Pregunta:
Fecha: 06-06-2019 06:59:03
(En Español)
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, string given in
Error cuando voy a realizar un inner join: Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result[Resuelta]
Buenas, tengo el siguiente código, cuando lo ejecuto.... me sale el siguiente error y no lo he podido arreglar... quien me ayudaWarning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, string given in
<?php $conexion=mysqli_connect('localhost','root','','pms24_db'); ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <link rel="stylesheet" href="css/estilos.css"> <title>INVENTARIO</title> <body background="img/fondook.png"> <script scr="js/main1.js"></script> <script type="text/javascript"></script> </head> <header class="header2"> <img src="img/logo_marcazeta.png"> <center> <h1 class="titulo1">INVENTARIO MARCAZETA LINEA</h1> <table class="table" id="mitabla"> <thead class="titulo"> <tr> <th>CLIENTE</th> <th>REFERENCIA</th> <th>DESCRIPCION</td> <th>MODELO</th> <th>CANTIDAD</th> <th>PRECIO</th> </tr> </thead> </header> <?php //$sql="SELECT * FROM mzt_reference"; //$result=mysqli_query($conexion,$sql); $query="SELECT r.reference, r.description, r.modelo , r.modelo, r.precio, c.client_id FROM mzt_reference r INNER JOIN mzt_client c ON r.client_id=c.client_id"; //$consulta=$conexion mysqli_query($conexion,$sql); $consulta=$conexion->query($query); while ($mostrar=mysqli_fetch_array($query)) { echo' <tr> <td style="font-size: 19px">'.$mostrar['reference'].'</td> <td style="font-size: 19px">'.$mostrar['description'].'</td> <td style="font-size: 19px">'.$mostrar['modelo'].'</td> <td style="font-size: 19px">'.$mostrar['modelo'].'</td> <td style="font-size: 19px">'.$mostrar['precio'].'</td> <td style="font-size: 19px">'.$mostrar['name'].'></td> </tr> '; } ?> </table> </center> </body> </html>.Votos: 0 - Respuestas: 2 - Vistas: 12 Compartir en: Google Facebook Twitter LinkedIn Link
Respuestas:
-
Fecha: 06-06-2019 07:20:18 Verifica bien esas dos lineas...
$consulta=$conexion->query($query); while ($mostrar=mysqli_fetch_array($query))
Saludos....
Stryfe™ Votos: 0 - Link respuesta -
Fecha: 09-06-2019 14:23:55 La línea que dice
while ($mostrar=mysqli_fetch_array($query))
debe ser
while ($mostrar=mysqli_fetch_array($consulta))
Votos: 2 - Link respuesta
Para participar activamente de la comunidad primero debes autenticarte, ingresa al sistema.Iniciar Sesión