2

In my Zend-Framework project, I want to execute a MySQL Procedure that perform some complex search operation's.

But I don't have any idea about HOW to call or create PROCEDURE'S, if requires.

Please suggest some code.....

Thanks In Advance.

Pushpendra
  • 4,344
  • 5
  • 36
  • 64
  • 1
    this will show you how to call it: http://stackoverflow.com/questions/1303912/how-can-i-use-a-stored-procedure-in-a-mysql-database-with-zend-framework – Marcin May 18 '11 at 12:50
  • 1
    I believe that this is not really a Zend_Framework related question. You simply execute an SQL query where you call/create the MySQL procedure. See here: http://www.brainbell.com/tutorials/MySQL/Using_Stored_Procedures.htm – Gergely Havlicsek May 18 '11 at 12:51
  • +1 Thanks Marcin, it will be very helpful for me.... – Pushpendra May 19 '11 at 10:02

2 Answers2

5

You can do it similar to how you prepare/bind normal SELECT/INSERT queries

$stmt = $db->prepare('CALL procedure(:param1, :param2)');
$stmt->bindValue(':param1', 0);
$stmt->bindValue(':param2', 1000);
$stmt->execute();
$rows = $stmt->fetchAll();
fin1te
  • 4,289
  • 1
  • 19
  • 16
0

Zend_db_statement can take any piece of SQL.

Frank Heikens
  • 117,544
  • 24
  • 142
  • 135