From: | Raymond O'Donnell <rod(at)iol(dot)ie> |
---|---|
To: | Alessandro Baggi <alessandro(dot)baggi(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: [OT] Postgresql and PHP |
Date: | 2016-12-23 15:52:31 |
Message-ID: | 3e5167cb-a5f9-be7d-5af6-8c83cc51f7d5@iol.ie |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 23/12/16 15:44, Alessandro Baggi wrote:
> Hi list,
> sorry for this OT.
>
> I have a table on postgresql like this:
>
> id serial not null,
> srcaddr varchar(16) not null
>
> I use this table to store ip address. I've used also inet type but
> changed to see if this solves my problem.
>
> From psql, I run:
>
> select count(*) from bs_ipsource where srcaddr = '192.168.1.1';
>
> and query is performed.
>
> From php I'm trying to do the same with this code:
>
> $ipsrc = "192.168.1.1";
>
> $query = pg_query_params($dbcon, "SELECT count(*) from bs_ipsource where
> srcaddr = $1", array($ipsrc));
> if(!$query) { print error...}
Are you sure it's failing? Try this:
if ($query === false) {
....
}
PHP has funny ideas about what's true and false.
Ray.
--
Raymond O'Donnell :: Galway :: Ireland
rod(at)iol(dot)ie
From | Date | Subject | |
---|---|---|---|
Next Message | Alessandro Baggi | 2016-12-23 15:58:58 | Re: [OT] Postgresql and PHP |
Previous Message | David G. Johnston | 2016-12-23 15:52:25 | Re: [OT] Postgresql and PHP |