public function updateAction() { $article_id = $_POST['id_article']; ArticleModel::getArticle($this->pdo, $article_id); $result = ArticleModel::getArticle($this->pdo, $article_id); if ($_SESSION['id_user'] != $result['id_user']) { return json_encode(["error" => "utilisateur"]); } if (empty($_POST['article_title']) || empty($_POST['article_content'])) { return json_encode(["error" => "champs"]); } ArticleModel::editArticle($this->pdo, $article_id, $_POST['article_content'], $_POST['article_title']); return json_encode(['message' => 'update', 'article_id' => $article_id, 'article_title' => $_POST['article_title'], 'article_content' => $_POST['article_content']]); }