Skip site navigation (1) Skip section navigation (2)

PL/pgSQL and PHP 5

From: PostgreSQL Admin <postgres(at)productivitymedia(dot)com>
To: Lista PG-PHP <pgsql-php(at)postgresql(dot)org>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: PL/pgSQL and PHP 5
Date: 2006-08-10 02:36:19
Message-ID: 44DA9BA3.2020801@productivitymedia.com (view raw or flat)
Thread:
Lists: pgsql-phppgsql-sql
I'm having this problem inserting data from my form using PL/pgSQL.  
Here is the simplified version of my table and function (this example 
does not work,  also ):

CREATE TABLE theirry.sample (
    staff_id serial PRIMARY KEY NOT NULL,
    firstname varchar(100),
    lastname varchar(150),
    username varchar(35),
    identifier varchar(40),
    address2 varchar(180),
    activated boolean,
    activated_keys varchar(32)
);

CREATE OR REPLACE FUNCTION insert_staff_b
    (insert_firstname varchar)
RETURNS VOID AS
$$
    DECLARE
    BEGIN       
            INSERT INTO theirry.sample
                (firstname)
            VALUES
                (insert_firstname);
        RETURN;
    END;
$$
LANGUAGE plpgsql;


I have a form with a value firstname then call the query in php

select insert_staff_b('$_POST['firstname']::varchar)


Still I get this error:
Warning: pg_query(): Query failed: ERROR: function 
insert_staff_b(character varying) does not exist HINT: No function 
matches the given name and argument types. You may need to add explicit 
type casts.

Suggestions or maybe a place to read up on this problem.

Thanks in advance,
J

In response to

Responses

pgsql-php by date

Next:From: John DeSoiDate: 2006-08-10 03:24:48
Subject: Re: PL/pgSQL and PHP 5
Previous:From: John DeSoiDate: 2006-08-02 18:09:13
Subject: Re: Problem with columns of type Text and Drupal/Prado/PHP5

pgsql-sql by date

Next:From: John DeSoiDate: 2006-08-10 03:24:48
Subject: Re: PL/pgSQL and PHP 5
Previous:From: Roman NeuhauserDate: 2006-08-09 17:24:56
Subject: Re: Query response time

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group