Advertisement
Guest User

Untitled

a guest
Nov 27th, 2015
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. static function obtenerAutomoviles(){
  2. $autos = DB::query("SELECT * FROM automoviles");
  3. $retorno = array();
  4. foreach($autos as $a){
  5. $automovil = automovil::fromDB($a->marca, $a->modelo, $a->version, $a->year, $a->usuario_id, $a->kilometraje, $a->info,
  6. $a->hits, $a->cilindrada, $a->estado, $a->color, $a->categoria, $a->precio, $a->idAutomovil);
  7. array_push($retorno, $automovil);
  8. }
  9. return $retorno;
  10. }
  11.  
  12. INDEX.PHP:
  13.  
  14. foreach(automovil::obtenerAutomoviles() as $a){
  15.  
  16.  
  17. RESULTADO:
  18.  
  19. https://i.gyazo.com/d25bcdb8a888d8fda79fd521abab7fa1.png
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement