私はこのコードをPHPでデータベースとしてPostgreSQLを使用しています。私はGETからすべてのパラメータを取得しています。印刷してチェックしてください。作成されたクエリはPostgres端末で実行されますが、PHPスクリプトからは失敗します。update query php postgresが何の理由もなく失敗しました
ここにコードがあります。
<?php
$link = pg_connect("host=localhost dbname=postgres user=postgres password=password") or die('connection failed');
# Building the query
$newq=sprintf("update purchase_info set ....... comments=%s where id=%s",......,$comm,$id);
print $newq; // This query runs on the postgres terminal
$query=addslashes($newq); // to escape "" as one of my fields is comments
$result=pg_query($link,$newq);
if (!$result) {
echo "An error occured.\n";
}
pg_close($link);
?>
他のクエリは同じスクリプトで実行されます。このSQLステートメントには、約14フィールドが更新されています。
何が間違っているか聞いています。 ヘルプをよろしくお願いします。
「理由なし」に何も失敗しません。 – Brad