CREATE OR REPLACE FUNCTION adduser(fn character varying,ln character varying,cit character varying,i integer,id integer)
RETURNS void AS
$BODY$
BEGIN
update tabtow set fname=fn,lname=ln,city=cit,phnum=i where phnum=id;
select * from tabtow;
END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION increment(integer)
OWNER TO postgres;
这是我的函数,我如何在 PHP 中调用它?
我正在尝试这样,但它不起作用:
$sql = "update tabtow set fname = '$_REQUEST[fn]', lname = '$_REQUEST[ln]', city = '$_REQUEST[ci]', phnum = $_REQUEST[phnum] where phnum = $_REQUEST[id1]";
$res = pg_query($sql);