Solved

Calling a MySQL Stored Procedure

Posted on 2006-11-22
2
225 Views
Last Modified: 2013-12-12
Hi guys,

What's the syntax for calling a MySQL Stored Procedure, and looping through the results? (It's a bunch of queries and gives out results)

Cheers!
0
Comment
Question by:Cyber-Drugs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 35

Accepted Solution

by:
Raynard7 earned 500 total points
ID: 17999812
Hi,

You should be able to treat the output as a normal query - noting that you have to use mysqli

$query = "Call dbName.StoredProc($param1, $param2)";

if ($result = mysqli_query($link, $query)) {

   /* fetch associative array */
   while ($row = mysqli_fetch_assoc($result)) {
       printf ("%s (%s)\n", $row["Name"], $row["CountryCode"]);
   }

   /* free result set */
   mysqli_free_result($result);
}


(above is manipulation of example from http://uk2.php.net/manual/en/function.mysqli-fetch-assoc.php)
0
 
LVL 4

Author Comment

by:Cyber-Drugs
ID: 17999833
Cheers Raynard7! :)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo‚Ķ
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question