Функция для соединений с БД
function db(){
static $db = null;
if(is_null($db)){
$db = new PDO("mysql:host=".DBHOST.";dbname=".DBNAME, DBUSER, DBPSWD, array(
PDO::ATTR_PERSISTENT => true
));
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
$db->query('set names utf8');
}
return $db;
}
Отправляю так
$sql = "UPDATE `table` SET (`amount`, `signature`, `plan`) VALUES (:amount, :signature, :plan) WHERE inv_id = :inv_id";
$stmt = $db->prepare($sql);
$stmt->bindValue(':inv_id', $inv_id);
$stmt->bindValue(':amount', $out_summ);
$stmt->bindValue(':signature', $crc);
$stmt->bindValue(':plan', $plan);
$stmt->execute();
Ошибка
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(
amount
,signature
,plan
) VALUES ('135', 'cdf15c5b50444f8ddde7c752261a5874' at line 1'
update table set field1 = 'value', field2 = 'value'
?