Ver originalfunction all_results() { while ($row = sql_fetch_result()) { yield $row; }} foreach (all_results() as $row) { print_r($row);}