Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. GROUP1
  2. sgroup1-a
  3. sgroup1-b
  4. sgroup1-c
  5. sgroup1-d
  6. GROUP2
  7. sgroup2-a
  8. sgroup2-b
  9.  
  10. GROUP1
  11. sgroup1-a
  12. GROUP1
  13. sgroup1-b
  14. GROUP1
  15. sgroup1-c
  16. GROUP2
  17. sgroup2-a
  18. GROUP2
  19. sgroup2-b
  20. sgroup1-d
  21.  
  22. CREATE TABLE IF NOT EXISTS `groupe` (
  23. `id_hm` int(2) NOT NULL AUTO_INCREMENT,
  24. `groupe_tran` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
  25. `onoff` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1' COMMENT '0:no, 1:active',
  26. `search` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0' COMMENT 'include in search menu, 0: 0ff, 1: on',
  27. PRIMARY KEY (`id_hm`)
  28. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=11 ;
  29.  
  30.  
  31. CREATE TABLE IF NOT EXISTS `sgroupe` (
  32. `id_bm` int(2) NOT NULL AUTO_INCREMENT,
  33. `id_hm1` tinyint(2) NOT NULL COMMENT 'head menu id',
  34. `sgroupe_tran` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
  35. `sgroupe_en` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
  36. `onoff` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '1' COMMENT '0:no, 1:active',
  37. `search` enum('0','1') COLLATE utf8_unicode_ci NOT NULL DEFAULT '0' COMMENT 'include in search menu, 0: 0ff, 1: on',
  38. PRIMARY KEY (`id_bm`)
  39. ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=49 ;
  40.  
  41. $sSel = 'SELECT DISTINCT(groupe_tran), sgroupe_tran FROM groupe JOIN sgroupe ON groupe.id_hm = sgroupe.id_hm1 WHERE groupe.search = "1" AND sgroupe.search = "1" AND groupe.onoff = "1" AND sgroupe.onoff = "1"';
  42.  
  43. $sReq = $connexion->query($sSel);
  44. $sRes = $sReq->fetchAll();
  45.  
  46. echo '<select name="groupe">';
  47. foreach ($sRes as $sV) {
  48.  
  49. $groupe_tran = $sV['groupe_tran'];
  50. $sgroupe_tran = $sV['sgroupe_tran'];
  51.  
  52. echo '<option value="' . $groupe_tran . '">' . $groupe_tran . '</option>';
  53. echo '<option value="' . $sgroupe_tran . '">' . $sgroupe_tran . '</option>';
  54. }
  55. echo '</select>';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement