I have a list of URLs in my homepage which is like SO in the following form
<a href="?questions&questions=777">link1</a>
<a href="?questions&questions=666">link2</a>
The following PHP script has a problem in the parameter of $_GET
.
$dbconn = pg_connect("host=localhost port=5432 dbname=masi user=masi password=123");
// A QUESTION SELECTED BY USER
// to generate the answers for the given question
$result = pg_prepare($dbconn, "query9", "SELECT title, answer
FROM answers
WHERE questions_question_id = $1;"); // WARNINGS refer HERE
// TODO I am not sure if the syntax is correct for parametr inside $_GET
$result = pg_execute($dbconn, "query9", array($_GET["'question_id' = $questions_question_id"]));
// Problem HERE inside the $_GET
Thank you to Nos and Jikhan for solving the problem with $dbconn and to Simon for solving the main problem of this thread!
How can you get only the question_id from the URL such that Postgres understand the query?