Your SQL
sentence has a syntax error, and mysqli_query in those cases does not return a object, but FALSE
.
I suggest you perform two actions:
a) Change the construction to evaluate the value returned in an IF, it could be as simple as this:
if ($resultado = $mysqli->query($miSentenciaSQL)) {
printf("La selección devolvió %d filas.\n", $resultado->num_rows);
$resultado->close();
} else {
/* no utizes die en la vida real, acá maneja el error o informa al usuario. */
die "$misqli devolvió FALSE";
}
b) fix your SQL statement (you need the clause from
), I guess what you really want is this:
SELECT * from 'grupos'
Putting together both, and making other small changes, something like this might look like:
public function muestraGrupos(){
$conexion = $this->Conectar();
if ($resultado = mysqli_query($conexion, "SELECT * from 'grupos'")) {
$filas = $resultado->fetch_all();
$resultado->close();
return $filas;
} else {
return FALSE;
{
}