Jump to content

Active class wont work


Joepiooo1988

Recommended Posts

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.