function leer_actividades($query, $dbhandler) { $table = $dbhandler->query($query); $result = array(); if ($table->num_rows > 0) { // output data of each row while ($row = $table->fetch_assoc()) { $actividad = new Actividad(); $actividad->read_actividad($row); $result[] = $actividad; } } else { echo "no results"; } return $result; }