Skip to content
Advertisement

Stored procedure – would like to read OUTPUT parameter and select-resultset

I have the following stored procedure:

JavaScript

I would like to call this stored procedeure in PHP with MySqli in PHP, in Procedural style. Tried a lot of diffrent code in PHP. Can someone advice how I can do this best?

Code I tried:

JavaScript

enter image description here

enter image description here

Advertisement

Answer

I would like to share the final result on how I have overcome the issue and found a solution.

MySQL stored procedeure:

JavaScript

in PHP I’ve done the following:

  • Check if the resultset came back with zero rows – meaning stored procedeure was executed correctly, but no results were found, else
  • Check if the resultset has a field called ‘spResult’. If so, read and populate result on screen, else
  • Handle resultset as you wish.

Sample in PHP:

JavaScript

I hope someone finds this answer usefull; of course open for further improvements 🙂

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement