Solved

Calling a MySQL Stored Procedure

Posted on 2006-11-22
2
221 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
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

816 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now