How can you check if a resource is false in PHP`s pg query params?
I run the following code unsuccessfully
$row = pg_num_rows ( $result );
if ( $row !== 0 )
echo "hurray";
else
echo "argh";
It gives me the following warnings
Warning: pg_query_params() [function.pg-query-params]: Query failed: ERROR: invalid input syntax for integer: "" in /var/www/codes/index.php on line 120
I use $dbconn
which is correct so the the second warning seems to be only a sympton.
The cause of this is the invalid type for an integer.
My query is this
$dbconn = pg_connect("host=localhost port=5432 dbname=masi user=masi password=123");
$result = pg_query_params ( $dbconn,
'SELECT question_id
FROM questions
WHERE question_id = $1',
array ( $question_id )
);
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…