echo $_POST['IDnum'];
$result = pg_prepare($conn, "city_delete",
"DELETE FROM lab5.city WHERE lab5.city.id = $1");
$result = pg_execute($conn, "city_delete", array($_POST['IDnum']));
这将显示要删除的行的正确ID号,并将在PSQL中删除它,但在PHP内部实现时不会删除?有什么想法吗?
答案 0 :(得分:1)
试试这个:
$result = pg_prepare($conn, "city_delete",
'DELETE FROM lab5.city WHERE lab5.city.id = $1');
您使用的双引号使$ 1变为PHP变量而不是字符串。
请参阅此处的pg_prepare示例:http://php.net/manual/en/function.pg-prepare.php