using postgresql functions from php - Mailing list pgsql-general

From RobertD.Stewart@ky.gov
Subject using postgresql functions from php
Date
Msg-id 06AF099D94D33B4D9120504521D6539D0FC6E917@agency33.state.ky.us
Whole thread Raw
Responses Re: using postgresql functions from php
List pgsql-general

I have created a function in postgresql

 

CREATE OR REPLACE FUNCTION public.insert_vpn_masteraccount(varchar, varchar, varchar, varchar, varchar, varchar, varchar, varchar, varchar)

  RETURNS varchar AS

'

DECLARE

 

BEGIN

 insert into masteraccount(fname,midint,lname,username,atype) values($1,$2,$3,$4,$5);

 insert into passwd(u_id,currentpwd) values((select max(u_id) from masteraccount where username=$4),$6);

 insert into ipinfo(u_id,ipaddress,atype) values((select max(u_id) from masteraccount where username=$4),$7,$5);

 insert into userinfo(u_id,agency,user_email) values((select max(u_id) from masteraccount where username=$4),$8,$9);

 return masteraccount.u_id where masteraccount.username=$4;

 

END;

'

  LANGUAGE 'plpgsql' VOLATILE;

 

I can insert data using this function with a sql statement  by typing

select insert_vpn_masteraccount(‘tom’,’d’,’johnson’,’tomd.johnson’,’V’,’1234’,’DHCP’,’AGR’,’idontcare@care.com’

 

this works fine

but when I try to do it from a php web page using

 

$enter = $db_object->query("SELECT insert_vpn_masteraccount('$fname','$mi','$lname','$acc_type','$passwd','$ip','$agency','$contact')");

 

This does not work

Can anyone help me?

 

Thanks

 

 

Robert Stewart

Network Eng

Commonwealth Office of Technology

Finance and Administration Cabinet

101 Cold Harbor

Work # 502 564 9696

Cell # 502 330 5991

Email RobertD.Stewart@ky.gov

 

pgsql-general by date:

Previous
From: Frank van Vugt
Date:
Subject: Re: RC1, missing -lpthread when building with --disable-shared on i686
Next
From: Larry White
Date:
Subject: using inheritance in production application.