I'm trying to connect with php
mysql
, they gave me an old code, use mysql
classic then I wanted to use mysqli
but I get an error in
mysqli_fetch_array () expects parameter 1 to be mysqli_result, boolean given "
I saw other pictures but it does not fit anything, I would like to know why I get an error
function consultaUsuarios($conexion){
$conex= new mysqli('localhost','root','root','call_center');
$salida='';
//Realizamos la Consulta que nos traera todos los registros de la BD
$query="select id,marca,producto,nombre,area
from creacion";
$total=mysqli_query($conex,$query);
$consulta=$conex->query($query);
//Validamos si hay o no registros
if(!$total || mysqli_num_rows($total) == 0){
while($dato=mysqli_fetch_array($total)){
$salida.='
<tr>
<td>'.$dato["id"].'</td>
<td>'.$dato["marca"].'</td>
<td>'.$dato["producto"].'</td>
<td>'.$dato["nombre"].'</td>
<td>'.$dato["area"].'</td>
<td class="'.returnStatus($dato["status"]).'">'.$dato["status"].'</td>
<td ><a class="btn btn-small">Editar</a></td>
</tr>
';
}
}
else
{
$salida='
<tr id="sinDatos">
<td colspan="7">No hay Registros en la Base de Datos, Tu codigo!!</td>
</tr>
';
}
The connection I put in just to practice something fast