我的主页中有一个URL列表,如下表所示
<a href="?questions&questions=777">link1</a>
<a href="?questions&questions=666">link2</a>
Run Code Online (Sandbox Code Playgroud)
以下PHP脚本在参数中有问题$_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
Run Code Online (Sandbox Code Playgroud)
感谢Nos和Jikhan用$ dbconn解决问题,并感谢Simon解决了这个线程的主要问题!
如何从URL中获取问题_id,以便Postgres理解查询?
| 归档时间: |
|
| 查看次数: |
126 次 |
| 最近记录: |