Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function joinTable(array $pole, $withTable, $spojS) {
- if($pole AND $withTable AND $spojS){
- $pole2 = NULL;
- foreach($pole AS $kluc)
- {
- $retazec = $this->name.".".$kluc.", ";
- if($pole2)
- {
- $pole2 .= "$retazec";
- } else {
- $pole2 = "$retazec";
- }
- }
- return dibi::fetch('SELECT '.$pole2.''. $this->name .'.id, '.$withTable.'.id AS '.$withTable.'_id
- FROM ['. $this->name . ']
- LEFT JOIN ['. $withTable . '] ON ('. $this->name .'.id = '.$spojS.')
- WHERE '. $this->name .'.id = '.$spojS.'
- ');
- } else {
- throw new DibiException('Neplatne argumenty pre spojenie tabuliek');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement