News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Maggie Nelson's Blog:
How to (and how not to) pass an array from PHP to the database
July 16, 2007 @ 11:13:00

In a new post today, Maggie Nelson starts with the wrong way to do something - passing an array from PHP to a database - and works backward to make it all right.

It would be really useful to have an easy way to pass arrays as bound parameters to queries or procedures from PHP. This would be especially useful if you're letting Oracle handle most of your data manipulating (as you should).

She includes an example of how she's like it to work. Sadly, it doesn't but there are some ways that a developer could get close. Here's her process:

  • No queries in loops, please!
  • In the ideal world...
  • Put all your DML in stored procedures.
  • str2tbl
  • The list_pkg package
  • list_pkg in your procedure
  • list_pkg in your PHP
  • Leveraging list_pkg

The list_pkg is based around this article from AskTom.

0 comments voice your opinion now!
array bind query parameter listpkg stored procedure array bind query parameter listpkg stored procedure


blog comments powered by Disqus

Similar Posts

Stijn Leenknegt's Blog: [PHP6] function-return-array idea!

php|architect: Stored Procedure Programming for MySQL5 (Part 1)

PHP-Coding-Practices.com: How I Turned A Slow Array Sort Into A Quick One Using Quicksort Algorithm

Derick Rethans' Blog: Overloaded properties (__get)

Stubbles Blog: Two New PHP6 Wishlist Items


Community Events





Don't see your event here?
Let us know!


series community symfony list release laravel language package install library podcast tips bugfix interview opinion voicesoftheelephpant introduction deployment api framework

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework