Re: [GENERAL] [OT] Postgresql and PHP

Поиск
Список
Период
Сортировка
От Raymond O'Donnell
Тема Re: [GENERAL] [OT] Postgresql and PHP
Дата
Msg-id 3e5167cb-a5f9-be7d-5af6-8c83cc51f7d5@iol.ie
обсуждение исходный текст
Ответ на [GENERAL] [OT] Postgresql and PHP  (Alessandro Baggi <alessandro.baggi@gmail.com>)
Список 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@iol.ie


В списке pgsql-general по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: [GENERAL] [OT] Postgresql and PHP
Следующее
От: Alessandro Baggi
Дата:
Сообщение: Re: [GENERAL] [OT] Postgresql and PHP