Ejemplo n.º 1
0
 public function create($nom)
 {
     $category = new Categorie($this->link);
     $category->setTitre($nom);
     $nom = mysqli_real_escape_string($this->link, $category->getCategory());
     $request = "INSERT INTO categories VALUES(NULL, '" . $nom . "')";
     $res = mysqli_query($this->link, $request);
     if ($res) {
         return $this->select(mysqli_insert_id($this->link));
     } else {
         throw new Exception("Internal server error");
     }
 }