I get the following error:
Warning: mysqli_fetch_array () expects parameter 1 to be mysqli_result, boolean given in C: \ Program Files (x86) \ VertrigoServ \ www \ sdp \ search.php on line 25
<?php
function nombreofcyciu($codofc,$entidad)/*BUSCAR NOMBRE OFICINA y ciudad*/
{ include ("conectar.php");
$sql=mysqli_query($link,"SELECT * FROM $entidad WHERE item='$codofc'");
$filasql=mysqli_fetch_array($sql); /* Linea de error*/
$nombreofc[0]=$filasql['oficina'];
$nombreofc[1]=$filasql['ciudad'];
return($nombreofc);
}
?>
the Connection to the BD works well, although I leave the code of the connection.
there was no connection. ' mysqli_error ()); } $ db = mysqli_select_db ($ link, "generator2") or die (mysqli_error ($ link)); ? >In the database there is a table and the column called in the query, because when you print the values of the query by console, it shows them correctly.
function nombreofcyciu ($ codofc, $ entity) / SEARCH NAME OFFICE and city / { include ("conecta.php"); $ sql = mysqli_query ($ link, "SELECT * FROM $ entity WHERE item = '$ codofc'"); echo "console.log ('SELECT * FROM $ entity WHERE item = $ codofc');"; $ rowsql = mysqli_fetch_array ($ sql); }
PDTA. I still can not find the solution and I already discard the possible causes mentioned above. Is there something I'm missing?