Faq::update PHP Méthode

update() public méthode

public update ( $id, $postdata )
    public function update($id, $postdata)
    {
        if ($this->user->getClass() < User::CLASS_ADMIN) {
            throw new Exception(L::get("PERMISSION_DENIED"), 401);
        }
        $sth = $this->db->prepare("UPDATE faq SET type = ?, question = ?, answer = ?, flag = ?, categ = ?, `order` = ? WHERE id = ?");
        $sth->bindParam(1, $postdata["type"], PDO::PARAM_STR);
        $sth->bindParam(2, $postdata["question"], PDO::PARAM_STR);
        $sth->bindParam(3, $postdata["answer"], PDO::PARAM_STR);
        $sth->bindParam(4, $postdata["flag"], PDO::PARAM_INT);
        $sth->bindParam(5, $postdata["categ"], PDO::PARAM_INT);
        $sth->bindParam(6, $postdata["order"], PDO::PARAM_INT);
        $sth->bindParam(7, $id, PDO::PARAM_INT);
        $sth->execute();
    }

Usage Example

<?php

include_once $CFG->dirroot . "/lib/classes/" . "application/Faq.Class.php5";
$faqObj = new Faq();
$vFromIP = $_SERVER['REMOTE_ADDR'];
$GeneralObj->getRequestVars();
$faqObj->setAllVar();
if ($mode == "Add") {
    $faqObj->insert();
    $msg = MSG_ADD;
    $url = 'index.php?file=Faq&AX=Yes&var_msg=' . $msg;
    header("Location:" . $url);
    exit;
} else {
    if ($mode == "Update") {
        $faqObj->update($iFaqId);
        $msg = MSG_UPDATE;
        $url = 'index.php?file=Faq&AX=Yes&var_msg=' . $msg;
        header("Location:" . $url);
        exit;
    }
}
All Usage Examples Of Faq::update