Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Database

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German
View previous topic :: View next topic  
Author Message
HyperV
Smarty n00b


Joined: 03 Aug 2015
Posts: 3

PostPosted: Mon Aug 03, 2015 7:22 am    Post subject: Database Reply with quote

Hallo Leute,

habe folgendes Problem:

Gegeben:
Datenbankname: bewerbungen
brauche davon den Tabellenwert "bearbeiter".
Egal wie ich das mache, es gibt mir keinen Wert aus. Dabei übergebe ich den Variablenwert an Smarty... , auf den ich ja zugreifen können müsste.

Bitte um Hilfe, dass ganze hat mich schon 2 Tage gekostet.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Mon Aug 03, 2015 6:13 pm    Post subject: Database Reply with quote

Setze mal $smarty->debugging = true;

Dann siehst Du zunächst mal welche Werte die Template variablen tatsächlich haben.

Ansonsten musst Du mal das Code Segment posten wo Du die Datenbank liest und die Werte assigns.

Ich kann ja nicht hellsehen was Du gemacht hast.


Außerdem: Bitte fülle bei einem Post bitte immer die Subject Zeile aus.
Sonst kann man später Dein Topic nicht öffnen.
Als Admin könnte ich es diesmal nachholen.
Back to top
View user's profile Send private message
HyperV
Smarty n00b


Joined: 03 Aug 2015
Posts: 3

PostPosted: Tue Aug 04, 2015 7:26 am    Post subject: Database Reply with quote

Tut mir Leid, war mein erster Post.

hier der komplette Code von der Funktion. Das mit den Pfeilen (unten) ist mein Problem.

Code:
function usermanagement() {
                if($this->hParams['user']['access_lvl'] < 5) {
                        header ( "Location: /error/overview/id/2" );
                        exit();
                }
                // Gruppen einlesen
                $groupresult = $this->db->query("SELECT id, name FROM gruppen");
                $grouparray = array();
                while($grouparrayline = $groupresult->fetch()) {
                        $grouparray[$grouparrayline['id']] = $grouparrayline['name'];
                }
                $this->smarty->assign('gruppen', $grouparray);

                $showgroup = $this->get('showgroup');
                if(!isset($showgroup)) {
                        $showgroup = "clanmember";
                }
                $desc = $this->get('desc');
                $orderby = $this->get('orderby');
                if(!isset($orderby)) {
                        $orderby = "rang";
                        $desc = "DESC";
                }


 if(isset($showgroup) && $showgroup!="alle" && $showgroup!="admins" && $showgroup!="clanmember" && $showgroup!="trials" && $showgroup!="user") {
                        $sth = $this->db->prepare("SELECT u.id AS uid, benutzername, rang, anmeldung, letzterlogin, bearbeiter
                                                                           FROM benutzerkonten u INNER JOIN gruppenmember g
                                                                           ON g.gruppenid=:group WHERE u.id=g.userid ORDER BY :order DESC");
                        $sth->execute(array('group' => $showgroup, 'order' => $orderby));
                } else {
                        if($showgroup=="admins") {
                                $condition = "rang>4";
                        } elseif($showgroup=="clanmember") {
                                $condition = "rang>1";
                        } elseif($showgroup=="trials") {
                                $condition = "rang=2";
                        } elseif($showgroup=="user") {
                                $condition = "rang=1";
                        } else {
                                $condition = "rang>0";
                        }
                        $sth = $this->db->query("SELECT id AS uid, benutzername, rang, anmeldung, letzterlogin, bearbeiter
                                                                         FROM benutzerkonten WHERE $condition ORDER BY $orderby $desc");

                }
                $data = $sth->fetchAll(PDO::FETCH_ASSOC);

                foreach($data as &$user) {
                        $id = $user['uid'];
                        $sth = $this->db->query("SELECT gruppenid FROM gruppenmember WHERE userid=$id");
                        $garray = $sth->fetchAll(PDO::FETCH_ASSOC);
                        $user['gruppen'] = $garray;
                }
                unset($user);

                $this->smarty->assign('users', $data);

  - -> $sth = $this->db->query("SELECT bearbeiter FROM bewerbungen
                                      INNER JOIN benutzerkonten ON  id=bearbeiter
                                           WHERE status!=0") ;

          $this->smarty->assign('bearbeiter_id', $bearbeiter_id); <--

}
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP