News Feed
Jobs Feed
Sections

Recent Jobs

News Archive
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



Similar Posts

Internet Super Hero Blog: PHP: mysqli_stmt_get_result()

Derick Rethans' Blog: Overloaded properties (__get)

David Otton's Blog: Neat PHP tricks: Casting Arrays to Objects

John Coggeshall's Blog: Alan has smoked too much PHP

Tim Koschuetzki's Blog: Composing Methods: Remove Assignments to Parameters


Community Events







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


package releases book zend PHP5 zendframework developer security database cakephp ajax framework job PEAR conference code release mysql example application

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