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

From David G. Johnston
Subject Re: [GENERAL] [OT] Postgresql and PHP
Date
Msg-id CAKFQuwb9_x=uJsQwtXPxc5sRS_6wMZV9ViWhL4+tubVSSysFnw@mail.gmail.com
Whole thread Raw
In response to [GENERAL] [OT] Postgresql and PHP  (Alessandro Baggi <alessandro.baggi@gmail.com>)
Responses Re: [GENERAL] [OT] Postgresql and PHP
List pgsql-general
On Fri, Dec 23, 2016 at 8:44 AM, Alessandro Baggi <alessandro.baggi@gmail.com> wrote:
$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'

​You might wish to explain how you've defined "fail" since there is no actual error.

One common explanation is that the database psql is talking to, which has the relevant data, is not the same database that PHP is talking to, and which lacks matching data.

You might want to fire off one or more "host machine identification"​ queries in both just to confirm whether this is the case.

David J.

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: [GENERAL] [OT] Postgresql and PHP
Next
From: Raymond O'Donnell
Date:
Subject: Re: [GENERAL] [OT] Postgresql and PHP