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

Untitled

By: a guest on Jun 30th, 2012  |  syntax: None  |  size: 0.83 KB  |  hits: 13  |  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. jQuery Selects Plugin, pull variables from database
  2. $counties = array();
  3. $counties['1']['BARN'] = 'Barnstable';
  4. $counties['1']['PLYM'] = 'Plymouth';
  5. $counties['2']['CHIT'] = 'Chittenden';
  6. $counties['3']['ANDE'] = 'Anderson';
  7.        
  8. $counties = array();
  9. $sql = "SELECT
  10.         id,
  11.         naam,
  12.         klant_id
  13.         FROM contactpersoon
  14.         ORDER BY klant_id ASC ";
  15.  
  16. if(!$res = mysql_query($sql,$con))
  17. {
  18.     trigger_error(mysql_error().'<br />In query: '.$sql);
  19. }
  20. else
  21. {
  22.     while ($row = mysql_fetch_array($res))
  23.     {
  24.         $counties[$row['klant_id'][$row['id'] =  htmlentities($row['naam']);
  25.     }
  26. }
  27.        
  28. $counties[$row['klant_id'][$row['id'] =  htmlentities($row['naam']);
  29.        
  30. $counties [$row['klant_id']] [$row['id']] =  htmlentities($row['naam']);
  31.        
  32. $a = $row['klant_id'];
  33. $b = $row['id'];
  34. $counties[a][b]= htmlentities($row['naam']);