Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

heropaulexy's avatar

PHP ERROR

I have got a little challenge with my PHP it's throwing this error

Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 2 in C:\xampp\htdocs\projects\product-crud\update.php:64 Stack trace: #0 C:\xampp\htdocs\projects\product-crud\update.php(64): PDOStatement->execute() #1 {main} thrown in C:\xampp\htdocs\projects\product-crud\update.php on line 64

0 likes
7 replies
SilenceBringer's avatar

@heropaulexy that's great! Check the line 64 on C:\xampp\htdocs\projects\product-crud\update.php

What do you expect from us without any piece of code?

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

@heropaulexy you have an extra closing )

$query = $pdo->prepare("UPDATE products SET title = :title, description = :description, image = :image, price = :price WHERE id = :id"); 
heropaulexy's avatar

this is the code. Line 64 is the last line

	 $query = $pdo->prepare("UPDATE products SET title = :title, 
                description = :description, image = :image, price = :price WHERE id = :id)");
      $query->bindValue(':title', $title);
      $query->bindValue(':description', $description);
      $query->bindValue(':image', $imagePath);
      $query->bindValue(':price', $price);
      $query->bindValue(':id', $id);
      $query->execute();

Please or to participate in this conversation.