title: How to call a MySQL stored procedure from within PHP code?
body: <p>I have stored procedure that I created in MySQL and want PHP to call that stored procedure.  What is the best way to do this?</p>
  
  <p>-MySQL client version: 4.1.11<br>
  -MySQL Server version: 5.0.45  </p>
  
  <p>Here is my stored procedure:</p>
  
  <pre><code>DELIMITER $$
  
  DROP FUNCTION IF EXISTS `getNodeName` $$
  CREATE FUNCTION `getTreeNodeName`(`nid` int) RETURNS varchar(25) CHARSET utf8
  BEGIN
   DECLARE nodeName varchar(25);
   SELECT name into nodeName FROM tree
   WHERE id = nid;
   RETURN nodeName;
  END $$
  
  DELIMITER ;
  </code></pre>
  
  <p>What is the PHP code to invoke the procedure getTreeNodeName?</p>