Re: [OT] Postgresql and PHP

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Alessandro Baggi <alessandro(dot)baggi(at)gmail(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: [OT] Postgresql and PHP
Date: 2016-12-23 19:06:37
Message-ID: 57c207b7-99b8-b58e-9215-4355de24d6e8@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/23/2016 08:03 AM, Alessandro Baggi wrote:
> Il 23/12/2016 16:52, David G. Johnston ha scritto:
>> On Fri, Dec 23, 2016 at 8:44 AM, Alessandro Baggi
>> <alessandro(dot)baggi(at)gmail(dot)com <mailto:alessandro(dot)baggi(at)gmail(dot)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.
>>
>
> Hi David,
> thanks for your answer.
> I don't think that this is the problem.
> Before the reported query I've other queries to the same db on other
> tables and works without problem.

Might want to set log_statement to 'all' at least temporarily:

https://www.postgresql.org/docs/9.5/static/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-WHAT

>
> Then I've only this db and only this host.
>
>
>
>
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2016-12-23 19:15:15 Re: [OT] Postgresql and PHP
Previous Message Edmundo Robles 2016-12-23 18:55:41 Re: Er Data Modeller for PostgreSQL