Reply to newbie: calling a stored procedure with INOUT parameter

Your name:

Reply:


Posted by Jeff on 01/22/07 10:31

Hey

I've created a stored procedure in a MySql5 database, and now I want to call
this SP from my php (php version 5.2.0) code.

Basically I don't know how to call this SP so that my php code can retrieve
the id (see parameter list in my SP, this parameter is a INOUT parameter)
parameter, so I post here just in case some of you have some tips about
this.

I want to use the object-oriented approach of mysqli

CREATE PROCEDURE SaveProperty ( INOUT id int unsigned, field1 int, field2
int)
BEGIN
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
END;
START TRANSACTION;
IF (id IS NULL) THEN
INSERT INTO Property (Field1, Field2) VALUES (field1, field2);
ELSE
UPDATE Property Set Field1 = field1, Field2 = field2 WHERE Id = id;
END IF;
COMMIT;
END;

Jeff

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация