We help IT Professionals succeed at work.
Get Started

Bind _Get Array to MySQL Stored Procedure

Member_2_241474
on
1,197 Views
Last Modified: 2012-08-18
I have a PHP page that gets 58 variables from a post and passes those to a MySQL (5.1) stored procedure that has the exact parameters in the same position as the post parameters.

I can get the _POST parameters one-by-one and make a parameter string to call the stored procedure, but now that is another place to have to change code when the vialriables change (and they often do.)    Isn't there some way just to bind the _POST[*] array to with something like

                            $stmt->bind_param($_POST[*]);

That particular code does not work, but it would make my life SO much easier if it did. I can't find a way to make it happen.  Is there a way to do this?  I have mysql, msqli and pdo loaded in PHP 5.1.6 with MySQL 5.1.53-MariaDB.

Is there something I can do without hard-coding all the post string variables into PHP?
Comment
Watch Question
Project Architect
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 13 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE