You are here: Calling a stored procedure with output parameters using mysqli « PHP Programming Language « IT news, forums, messages
Calling a stored procedure with output parameters using mysqli

Posted by evan.lavidor on 03/21/06 22:23

Hi all,

Forgive me if this topic has been discussed before. I've been doing
some searching and have yet to come across the answer I'm looking for.


I'm new to PHP, and I'm trying to call a MySQL stored procedure (using
mysqli) that has both input and output parameters. I have no problems
passing in the relevant params, but calling the output params is
confusing me. Most of the examples I see online deal with returning
recordsets, which I am not doing.

As a super-basic example, I've created the following sproc in MySQL:
CREATE PROCEDURE testproc(OUT p_testvar varchar(50)) BEGIN SET
p_testvar = 'HELLO WORLD!'; END

When I call this from MySQL I can do the following:
mysql> call testproc (@a);
mysql> select @a;
+--------------+
| @a |
+--------------+
| HELLO WORLD! |
+--------------+
1 row in set (0.00 sec)


But how would I do a similar call in PHP to retrieve the output
parameter?

Thanks very much for any help, samples, or resources that anyone can
point me towards.

Evan

 

Navigation:

[Reply to this 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

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