How do you read the following code about pg_query_params
and pg_prepare
?
$result = pg_query_params ( $dbconn,
"SELECT flagged_for_moderator_removal // unsure about Repetition here
FROM questions
WHERE question_id = $1",
array ( $_GET['question_id'] ) );
if ( pg_num_rows ( $result ) == 0 ) {
$result = pg_prepare ( $dbconn, "get_flagged_status_list",
"SELECT flagged_for_moderator_removal // unsure about Repetition here
FROM questions
WHERE question_id = $1"
);
}
This question is related to my thread where I do not want to declare twice the prepared statement.
The difference between statements is that the other has a name *get_flagged_status_list*, while the other one does not. I understand the code as follows
Iteration | 1 2
----------------------------------------------------------------------
run pg_query_params run pg_qeury_params
run pg_prepare
run pg_execute run pg_execute
However, this is not true, since the code runs pg_prepare
in the second iteration too.
1.