From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
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:51:09 |
Message-ID: | c8bee7db-ad35-d0a2-6f9a-595c7deb70f1@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 12/23/2016 07:44 AM, 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.
And what is the count?
>
> 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...}
>
> I don't understand why this query fails without error. I have searched
How do you know it fails?
> error in httpd logs and postgresql log without success.
>
> from postgresql logs i get:
>
> LOG: execute <unnamed>: SELECT count(*) from bs_ipsource where srcaddr
> = $1
> DETAIL: parameters: $1 = '192.168.1.1'
>
>
> I've tried also to use pg_last_error and errors are not printed.
>
> Can someone put me on the right way?
>
> Thanks in advance.
>
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2016-12-23 15:52:25 | Re: [OT] Postgresql and PHP |
Previous Message | Alessandro Baggi | 2016-12-23 15:44:33 | [OT] Postgresql and PHP |