I have the following code:
$escolha = $_POST['unidade'];
if($escolha == 'ut')
{
$conn = new mysqli($host1, $user, $pass, $bd);
if (mysqli_connect_errno()) {
die(mysqli_connect_error());
exit();
}else{
$consulta = $conn->query("SELECT nm_usu FROM usuarios;");
while ($resultado = $consulta->fetch()) {
echo "Nome: {$resultado['nm_usu']}<br/>";
}
}
}
And I have the following error:
Fatal error: Call to undefined method mysqli_result :: fetch () in
From what I've seen is not much different from examples than other sites, but what can it really be? Or what is the best way to do this?