0

I want to update a record in my database using pdo. The connection should not be the problem because I already use it for GET and INSERT.

try {

    // Create connection
    $conn = new PDO("mysql:host=$servername; dbname=$dbname", $username, $password);
    // set the PDO error mode to exception
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 

    $sql = "
    UPDATE tblanime 
    SET 

    title = '$title' , 
    synonyms = '$synonyms' , 
    episodes = '$episodes' , 
    score = '$score' , 
    type = '$type' , 
    status = '$status' , 
    start_date = '$start_date', 
    end_date  = '$end_date' , 
    synopsis = '$synopsis' , 
    image = '$image'  

    WHERE 'id'='34096' ";

    $conn->exec($sql);

}
catch(PDOException $e){
    echo $sql . "<br>" . $e->getMessage();
}
$conn = null;

Can someone help me understand what is going wrong? Kind regards,

matiaslauriti
  • 7,065
  • 4
  • 31
  • 43
Albin Gjoka
  • 305
  • 1
  • 2
  • 14

0 Answers0