Reputation: 111
I've been trying to figure this out for ages, and I can't seem to figure out what's wrong.
This works as intended:
$query = "SELECT DISTINCT(name) FROM customers WHERE name IS DISTINCT FROM NULL ORDER BY name ASC";
$result = pg_query($dbconn, $query);
But this doesn't work at all. It doesn't even return false. Nothing after it even renders.
$query = "SELECT DISTINCT(name) FROM customers WHERE name IS DISTINCT FROM $1 ORDER BY name ASC";
$result = pg_query_params($dbconn, $query, $array(NULL));
I'm using PHP 5.3 and Postgresql 8.4.
Upvotes: 1
Views: 514
Reputation: 58711
$query = "SELECT DISTINCT(name) FROM customers WHERE name IS DISTINCT FROM $1 ORDER BY name ASC";
$result = pg_query_params($dbconn, $query, $array(NULL));
^
^
You mean pg_query_params(..., array(NULL))
instead.
Upvotes: 1