hey guys,,I need some help on how to call the stored procedure using classes,,

I have my weeklyevent.sql file that contains stored procedure.One of this is updating a record

drop procedure editweeklyevent$$
create procedure editweeklyevent (
i_ses bigint,
i_weid int,
i_strt date,
i_end date,
i_act smallint,
i_min smallint,
i_vis tinyint,
i_name varchar(40),
i_cc varchar(80),
i_cont int,
i_ban varchar(40),
i_desc text
) begin

select person into @uid from usersession where sessionid=i_ses;

update weeklyevent set starton=i_strt, endon=i_end, activity=i_act, ministry=i_min,
visibility=i_vis, name=i_name, editon=curdate(), editby=@uid,
childcare=i_cc, contact=i_cont, banner=i_ban, descr=i_desc
where weid=i_weid;

end$$

and this is code using my Inline sql code

$eweid=$_POST;
$ename=$_POST;
$eminid=$_POST;
$econtact=$_POST;
$descr=$_POST;
$esql="Update weeklyevent SET name='$ename', ministry='$eminid', descr='$descr', contact='$econtact' where weid='$eweid'";
$vdb->Execute($esql);

I want to use stored procedure on it..How to call that procedure?..If you request my copy of my Class I will post it..

Recommended Answers

All 6 Replies

$esql = "CALL editweeklyevent()";

Inside the () put the variables in the correct order, as specified in the create procedure.

is it ok to put only what I want to update? is i_strt, i_end,i_weid so on and so fort variables you mean?

You need to pass what is specified in the stored procedure, if you want to pass less parameters, your stored procedure needs to be changed. Currently it needs 12 parameters.

do i need to $_Post the session ID? (i_ses)

The procedure is expecting it, so yes.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.