Re: Problem either with PostgreSQL or with PHP

From: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
To: Tuo Pe <tuo_pe(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Problem either with PostgreSQL or with PHP
Date: 2010-04-07 16:13:26
Message-ID: j2ydcc563d11004070913y78deafc6yd95cec8ba9084e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Apr 7, 2010 at 10:11 AM, Tuo Pe <tuo_pe(at)yahoo(dot)com> wrote:
> Hi!
>
> I have written this function in PL/pgSQL,
> CREATE OR REPLACE FUNCTION MakeSimpleReservation(integer, integer, integer, text, text) RETURNS boolean ...
>
> In my PHP script, I have this code:
>  $start_ts = '2010-04-12 11:00:00';
>  $end_ts   = '2010-04-12 14:00:00';
>
>  $update = pg_query($yhteys, "SELECT MakeSimpleReservation(2, 3, 1, '{$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?
>

Show me the php code.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-04-07 16:17:19 Re: Problem either with PostgreSQL or with PHP
Previous Message Tuo Pe 2010-04-07 16:11:44 Problem either with PostgreSQL or with PHP