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 'WHERE ip_address=::1' at line 1 in D:\Xampp\htdocs\SK Tuning\cart.php:133 Stack trace: #0 D:\Xampp\htdocs\SK Tuning\cart.php(133): PDO->query('UPDATE cart_det...') #1 {main} thrown in D:\Xampp\htdocs\SK Tuning\cart.php on line 133
Here is my code:
<?php
$get_ip_add=getIPAddress();
if(isset($_POST['update_cart'])){
$quantities=$_POST['qty'];
$update_cart="UPDATE cart_details SET quantity=$quantities WHERE ip_address='$get_ip_add'";
$result_products_quantity=$con->query($update_cart);
$total_price=$total_price*$quantities;
}
?>