Guest User

Untitled

a guest
Jul 20th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. $prefix = "dev_";
  2. $tables = [$prefix."pp", $prefix."pe", $prefix."chem", $prefix."fiber", $prefix."plastic", $prefix."qc", $prefix."cac", $prefix."electron"];
  3. $getSQL = '';
  4.  
  5. foreach ($tables as $key => $table) {
  6. if (!$getSQL) {
  7. $getSQL = "Select *, '".$table ."' as dep From ".$table." where `lang` = '".$lang."' and `chk` = 'Y'";
  8. } else {
  9. $getSQL .= " Union Select *, '".$table ."' as dep From ".$table." where `lang` = '".$lang."' and `chk` = 'Y'";
  10. }
  11. }
  12.  
  13. $getSQL .= " order by dep, year, sortIndex, title";
  14.  
  15. $getSQL = "Select id from ".$tables[0]." where 1=0";
  16. foreach ($tables as $key => $table) {
  17. $getSQL .= " Union Select *, '".$table ."' as dep From ".$table." where `lang` = '".$lang."' and `chk` = 'Y'";
  18. }
  19. $getSQL .= " order by dep, year, sortIndex, title";
Add Comment
Please, Sign In to add comment