Joepiooo1988 Posted May 22, 2012 Share Posted May 22, 2012 Hello, I'm working on a Class with my CMS and can't get it to work properly. It is the textClass of my cms. You can add and delete text on the website but I want to add an active or non active option. This is de code I got now but it isnt working and I cant find te problem. The radio button in my cms wich shows active or non active works fine and when i change it to non active it changes in the database to 0 so the problem isnt there I think. Can anybody help me out? Tnx:) public function getTeksten($database, $taal, $actief = NULL, $bladzijde = NULL, $id = NULL) { $sql = "SELECT * FROM ".$database."_teksten WHERE tekst_taal=:taal"; if(!empty($id)) { if(is_numeric($id)) { $sql .= " AND tekst_ID=:id"; } if(!empty($actief) && $actief == 1) { $sql .= " WHERE tekst_actief='1'"; } } else if(!empty($bladzijde)) { if(is_numeric($bladzijde)) { $sql .= " AND tekst_bladzijde=:bladzijde"; } else { return NULL; } } $sql .= " ORDER BY tekst_volgorde ASC"; try { $stmt = $this->db->prepare($sql); $stmt->bindParam(":taal", $taal, PDO::PARAM_STR); if(!empty($id) && is_numeric($id)) { $stmt->bindParam(":id", $id, PDO::PARAM_INT); } else if(!empty($bladzijde) && is_numeric($bladzijde)) { $stmt->bindParam(":bladzijde", $bladzijde, PDO::PARAM_INT); } $stmt->execute(); $result = $stmt->fetchAll(PDO::FETCH_OBJ); $stmt->closeCursor(); return $result; } catch(Exception $e) { die($e->getMessage()); } } I have to text items on my homepage and turned one to non active but what happened now is that is show all of my text items on my homepage. Cant find the problem:( Someone that can help me out here? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.