63227

Question:
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']));
This displays the correct ID number for the row to be deleted and will delete it inside PSQL, but will not delete when implemented inside the PHP? Any ideas?
Answer1:Try this:
$result = pg_prepare($conn, "city_delete",
'DELETE FROM lab5.city WHERE lab5.city.id = $1');
The double quotes you used make the $1 a PHP variable instead of a string.
See the example for pg_prepare here: <a href="http://php.net/manual/en/function.pg-prepare.php" rel="nofollow">http://php.net/manual/en/function.pg-prepare.php</a>