Example #1
0
 protected function del_dbcategory($id)
 {
     $pdo = parent::get_connect2db();
     try {
         $sql = 'DELETE FROM articlecategory WHERE categoryid=:id';
         $s = $pdo->prepare($sql);
         $s->bindValue(':id', $id);
         $s->execute();
     } catch (PDOException $e) {
         $error = 'Error in deleting articles from category: ' . $e->getMessage();
         die($error);
     }
     try {
         $sql = 'DELETE FROM category WHERE id=:id';
         $s = $pdo->prepare($sql);
         $s->bindValue(':id', $id);
         $s->execute();
     } catch (PDOException $e) {
         $error = 'Error in deleting category: ' . $e->getMessage();
         die($error);
     }
 }