must be one of PGSQL_ASSOC, PGSQL_NUM, or PGSQL_BOTH¶
Description¶
pg_fetch_all() 2nd argument must be one of 3 possible pgsql constants: PGSQL_ASSOC, PGSQL_NUM and PGSQL_BOTH.
It is also the case of pg_fetch_array() and pg_fetch_row()’s 3rd argument; and pg_select()’s 4th argument.
It is possible to use raw integers, instead of the constants, although this is not recommended.
Example¶
<?php
try {
var_dump(pg_last_notice($db, 99));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
?>
Solutions¶
Use one of the three constants.