i’m trying to update a product in this table called ‘livre’ using this php code but i keep getting the message “Erreur!! La modification a échoué


This Content is from Stack Overflow. Question asked by lele anayouss

I’m working on this project where i make a page online you can add ,update and show products on , and I’m trying to update a product in this table called ‘livre’ through the code down below ,but its not happening, I tried this code before on another table and it worked but this time i cant figure out the problem I keep getting the message “Erreur!! La modification a échoué.”,please help me find the error.


if(empty($_POST["code_l"])  ||  empty($_POST["titre"])||  
empty($_POST["aut"])  ||  empty($_POST["an_edi"]) || 
empty($_POST["edit"])  ||  empty($the_photo)  || empty($_POST["code_la"])  || 

    echo' Il faut saisir un code <br/>';

$photo = file_get_contents ($_FILES["photo"]['tmp_name']);
   $sql = "UPDATE livre set code_livre='".$code."',titre='".$titre."', auteur='".$aut ."', 
    code_domaine='".$cdom."'  WHERE code_livre=".$code;

  $requete = $conx->prepare($sql);

   if($stmt === false)
        die("Erreur!! La modification a échoué.");
     { header("location:lister_livre.php")  ;   }
    catch (PDOException $e)
        echo $e->getMessage();



This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?