Re: Problem either with PostgreSQL or with PHP

Поиск
Список
Период
Сортировка
От Frank Heikens
Тема Re: Problem either with PostgreSQL or with PHP
Дата
Msg-id 45F5B448-A6AA-40F4-A8A3-A10B4865FC70@mac.com
обсуждение исходный текст
Ответ на Problem either with PostgreSQL or with PHP  (Tuo Pe <tuo_pe@yahoo.com>)
Список pgsql-general
Op 7 apr 2010, om 18:11 heeft Tuo Pe het volgende geschreven:

> Hi!
>
> I have written this function in PL/pgSQL,
> CREATE OR REPLACE FUNCTION MakeSimpleReservation(integer, integer,
> integer, text, text) RETURNS boolean ...

text, text ?

> In my PHP script, I have this code:
> $start_ts = '2010-04-12 11:00:00';
> $end_ts   = '2010-04-12 14:00:00';

Looks like timestamps to me, why do you use TEXT in your function?

> $update = pg_query($yhteys, "SELECT MakeSimpleReservation(2, 3, 1,
> '{$start_ts}' , '{$end_ts}');");

Why not pg_query_params? That's made to receive parameters:

$update = pg_query_params($yhteys, "SELECT MakeSimpleReservation(2, 3,
1, $1, $2);", array($start_ts, $end_ts));

>
> On psql, I can run a command such as
>
> select * from MakeSimpleReservation(2, 30, 1, '2010-04-12 11:00:00',
> '2010-04-12 14:00:00');
>
> without any problems, but when I try to run it via PHP, I get this
> error message:
>
> ERROR: function makesimplereservation(integer, integer, integer,
> unknown, unknown) does not exist LINE 1: SELECT
> MakeSimpleReservation(2, 3, 1, '2010-04-12 11:00:00' ... ^ HINT: No
> function matches the given name and argument types. You might need
> to add explicit type casts.
>
> For some reason, the last two function parameters are not recognized
> as strings. Is this a problem with PHP or with PostgreSQL? Can
> anyone give me advice how to fix this?
>
> Tuo
>
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general





Frank Heikens
frankheikens@mac.com




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

Предыдущее
От: tv@fuzzy.cz
Дата:
Сообщение: Re: Problem either with PostgreSQL or with PHP
Следующее
От: Scott Marlowe
Дата:
Сообщение: Re: Problem either with PostgreSQL or with PHP