 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Harry Roberts' Blog: Manipulating PHP arrays with SQL
by Chris Cornutt May 22, 2008 @ 14:39:54
Harry Roberts has a quick post to his blog today showing a method he's come up with to handle PHP arrays from inside of SQL statements (a port of the JsonSQL library to PHP).
Trent Richardson created a very small and simple JsonSQL library for JavaScript which allows you to run an extremely limited subset of SQL against a Json array/object. I quickly ported it over to PHP 5 and it works like a charm, although the syntax for the WHERE clause isn't exactly the same but the rest ported across properly.
He's included some sample source code of it in action - selecting information out of an array of user information, once changing their order and the other grabbing a username. Complete source for the library is included too.
voice your opinion now!
manipulate array sql statement phpsql library port jsonsql
DevShed: PHP Statements and Beginning Loops
by Chris Cornutt November 05, 2007 @ 09:34:00
DevShed has posted the latest part of their introduction to PHP series, this time focusing on one of the more useful features of the language - conditionals and loops.
We discussed statements briefly in our last article and even got a sneak peek of an IF-statement. Sure I mean, the image was blurry, and the moment it saw us it ran off into the forest. But we saw it. Honest. So in this article, we're going to take a much closer look at PHP statements and even start learning about loops.
They cover if statements (as mentioned) as well as introduce you to its companions, else and else if. The finish off the article with a brief look at one of the simpler loops, the for loop.
voice your opinion now!
tutorial loop conditional statement elseif if for tutorial loop conditional statement elseif if for
Raphael Stolt's Blog: Transforming data centered XML into SQL statements
by Chris Cornutt May 08, 2007 @ 10:27:00
In this new post on Raphael Stolt's blog, he shows a way that you can take XML that holds SQL information (in his example INSERTs and DELETEs) and transforms them into SQL statements via XSL stylesheets.
A canny data import technique that emerged from praxis, while working on the import of data-centered XML resources, is utilitizing the abilities of Xslt. The generation of the required SQL statements actually only needs a simple Xsl stylesheet which might import for an PHP XSLTProcessor object or pass to the xsltproc command line tool. Both further described approaches are based upon the libxslt library and are assuming the use of XSLT 1.0.
He starts with an example bit of XML that has the XSL stylesheet at the top that will be used to transform the data and the information to perform inserts on several "partner" values in the XML below. Following this, he creates a PHP class to load the file and apply the stylesheet.
He also mentions a few different approaches to the same problem - XSLTProcessor class approach returning a single SQL string , xsltproc approach and the XSLTProcessor class approach using the ability to use PHP functions as XSLT functions.
voice your opinion now!
transform xml sql statement xslt insert delete transform xml sql statement xslt insert delete
Jeff Moore's Blog: PDO versus MDB2
by Chris Cornutt December 27, 2006 @ 10:41:00
In the constant pursuit of exploring what else is out there, Jeff Moore took a look at using PDO and MDB2 in some of his scripts and tried it out in a simple test program:
I was just putting together a small test program and I thought I would try using PDO. I really haven't done anything serious with PDO, just try it a couple times. Unfortunately, this didn't work and it took me a few minutes to figure out why. Actually, I still don't know exactly why it doesn't work, but I did find a way to make it work.
He found PDO slightly different to work with than what he was used to so he moved on to MDB2 to see how the same code would fare there. Things worked smoothly there, handling the prepared statements he wanted to use perfectly.
voice your opinion now!
pdo mdb2 database test prepared statement pdo mdb2 database test prepared statement
|
Community Events
Don't see your event here? Let us know!
|