Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 29th, 2012  |  syntax: None  |  size: 0.42 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Process SQL JOIN results with PHP
  2. parents:
  3. id | firstname | lastname
  4.  
  5. children:
  6. id | firstname | lastname
  7.  
  8. parent_child_link
  9. child_id | parent_id
  10.        
  11. SELECT *
  12. FROM children c
  13. JOIN parent_child_link l on l.child_id=c.id
  14. WHERE c.id=1
  15.        
  16. id | firstname | lastname | parent_id
  17. 1    test        test       1
  18. 1    test        test       2
  19.        
  20. array(
  21.     'firstname' => 'test',
  22.     'lastname' => test',
  23.     'parents' => array(1, 2)
  24. )