[GENERAL] [OT] Postgresql and PHP - Mailing list pgsql-general

From Alessandro Baggi
Subject [GENERAL] [OT] Postgresql and PHP
Date
Msg-id 7f7bb3fa-3499-e083-07d4-86fe422cd3a5@gmail.com
Whole thread Raw
Responses Re: [GENERAL] [OT] Postgresql and PHP
Re: [GENERAL] [OT] Postgresql and PHP
Re: [GENERAL] [OT] Postgresql and PHP
Re: [GENERAL] [OT] Postgresql and PHP
List pgsql-general
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...}

I don't understand why this query fails without error. I have searched
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.


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: [GENERAL] Bug? Netmask of CIDR as TEXT has trailing masklen
Next
From: Adrian Klaver
Date:
Subject: Re: [GENERAL] [OT] Postgresql and PHP