Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.87 KB | None | 0 0
  1.     public function joinTable(array $pole, $withTable, $spojS) {
  2.         if($pole AND $withTable AND $spojS){
  3.         $pole2 = NULL;
  4.         foreach($pole AS $kluc)
  5.         {
  6.             $retazec = $this->name.".".$kluc.", ";
  7.             if($pole2)
  8.             {
  9.                 $pole2 .= "$retazec";
  10.             } else {
  11.                 $pole2 = "$retazec";
  12.             }
  13.         }
  14.        
  15.         return dibi::fetch('SELECT '.$pole2.''. $this->name .'.id, '.$withTable.'.id AS '.$withTable.'_id
  16.                               FROM ['. $this->name . ']
  17.                               LEFT JOIN ['. $withTable . '] ON ('. $this->name .'.id = '.$spojS.')
  18.                               WHERE '. $this->name .'.id = '.$spojS.'
  19.                              ');
  20.         } else {
  21.             throw new DibiException('Neplatne argumenty pre spojenie tabuliek');
  22.         }
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement