Ver Mensaje Individual
  #9 (permalink)  
Antiguo 16/10/2013, 18:23
Avatar de NSD
NSD
Colaborador
 
Fecha de Ingreso: mayo-2012
Ubicación: Somewhere
Mensajes: 1.332
Antigüedad: 12 años
Puntos: 320
Respuesta: Acceder a variables de referencia

muchas gracias, he armado esto pero no funciona:

Código PHP:
Ver original
  1. protected function all_results($result) {
  2.     while ($row = $result->fetch_array(MYSQLI_ASSOC)) {    
  3.             yield $row;
  4.         }
  5.     }
  6.        
  7. protected function _bindResultados(mysqli_stmt $stmt)
  8.     {      
  9.         $result = $stmt->get_result();     
  10.          
  11.         foreach (all_results($result) as $row) {
  12.             print_r($row);
  13.                        $resultados[] = $row;
  14.         }
  15.         return $resultados;
  16.     }

me arroja:
Cita:
Parse error: syntax error, unexpected '$row' (T_VARIABLE)
probe a usar uno de los ejemplos del manual y tiran el mismo error, hace falta tener algo habilitado en el server para poder usarlos?
__________________
Maratón de desafíos PHP Junio - Agosto 2015 en FDW | Reglamento - Desafios