News Feed
Jobs Feed
Sections

Recent Jobs

News Archive
feed this:

SitePoint PHP Blog:
The state of functional programming in PHP
December 17, 2007 @ 10:28:00

On the SitePoint PHP Blog today, Troels Knak-Nielsen has written up a post concerning the current state of functional programming in PHP.

With the rise of Javascript, and languages like Python and Ruby, functional programming is becoming more mainstream. Even Java seems to be getting closures in the next version, so does this leave PHP lacking behind or is there an unrealized potential hidden within?

He looks at a few different aspects of functional programming and sees how well PHP fits into them (like dynamic dispatch, binding a variable to a function and an implementation of currying for a function). This last option is the only "true" functional feature that PHP can realistically handle.

0 comments voice your opinion now!
functional programming dynamic dispatch bind state function curry functional programming dynamic dispatch bind state function curry



Internet Super Hero Blog:
PHP mysqli_stmt_get_result()
August 22, 2007 @ 13:48:00

Frustrated with the lack of something simple (like mysql_fetch_assoc) in the new mysqli extension, this new function was created an posted about on the Internet Super Hero blog - mysqli_stmt_get_results.

By help of the new function, you can create a mysqli_result object from a statement that returns data (SELECT and other - version dependent!). Then you can use the mysqli_result object to process the returned data: fetch results, access meta data - all you can also do using a mysqli_result object returned by mysqli_query().

Included in the post are a few code examples showing the simplicity of the function and how it can still be used with the standard mysql_* functions to grab the results.

0 comments voice your opinion now!
bind value mysqlstmtgetresult object mysqlquery simple bind value mysqlstmtgetresult object mysqlquery simple


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


Paul Jones' Blog:
New PDO Behavior In PHP 5.2.1
February 28, 2007 @ 08:29:00

http://www.phpdeveloper.org/form/view/type/addnews PHPDeveloper.org: PHP News, Views, and Community In a new post Paul Jones points out some of the new behaviors that the extension is showing in the latest of the PHP 5 seres (version 5.2).

He starts with a code example that would work with a previous version of PHP/PDO that would allow for the binding of a single value to multiple places in the SQL statement. But:

Sadly, this is no longer the case in PHP 5.2.1. For valid reasons of security and stability in memory handling, as noted to me by Wez Furlong, the above behavior is no longer supported. That is, you cannot bind a single parameter or value to multiple identical placeholders in a statement. If you try it, PDO will throw an exception or raise an error, and will not execute the query. In short, you now need to match exactly the number of bound parameters or values with the number of placeholders.

Unfortunately, this is used quite often in Paul's Solar framework, so an update to the Solar_Sql_Adapter::query() method has had to been made to allow for the binding of multiple items automatically. It works by incrementing the bind location (like ":foo") with numbers at the end - simple and effective - and you can still pass an array to it and have it automagically work.

0 comments voice your opinion now!
pdo php5 behavior bind variable multiple array placeholder increment pdo php5 behavior bind variable multiple array placeholder increment


Ajaxian.com:
AjaxCore PHP Ajax Framework
November 22, 2006 @ 10:14:00

As mentioned over on Ajaxian.com, there's a new Ajax framework in town that's looking to "ease the development of rich Ajax applications, by generating the appropriate JavaScript code" - AjaxCore.

AjaxCore takes all the dirty work of JavaScript code generation and provides a solid foundation. The concept is to extend a Generic AjaxCore class and defining methods that handle the Ajax driven events and binding them to HTML objects.

It uses Prototype to work with the DOM and Ajax connections and to help you with binding the scripts to the different elements on the page. Code can be linked to certain elements and have that (server-side) code automatically executed when an element is referenced. You can find out more from the AjaxCore homepage and the Ajaxian post also includes a simple inline example to get you started.

0 comments voice your opinion now!
ajaxcore framework ajax bind element serverside code ajaxcore framework ajax bind element serverside code


PHPEverywhere:
PDO beta revisited
November 16, 2005 @ 06:10:03

In this new post on PHPEverywhere from John Lim today, there's a look at a PDO issue he's found involving a binding issue.

Today I downloaded the latest version of the PHP5.1 beta from snaps.php.net and tested PDO again for compatibility with ADOdb, the PHP database library i maintain. Then i compared the results with my last serious test in July 2005. In general, I find PDO remains in early beta state (functionality documented, but bits are not implemented).

One of my previous complaints was that binding did not work. I was worried that it was a coding problem on my part, but apparently that was not the case: the same code that failed in July works fine now, but there are still some glitches.

He gives the code that's causing him a problem, and mentions the error it throws as well as a few other problems that he's noticed along the way.

(Note: check out Wez's response to this posting as well...)

0 comments voice your opinion now!
php PDO beta bind error php PDO beta bind error



Community Events







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


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

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