Doctrine is an object relational mapper (ORM) for PHP 5.2.3+ that sits on top of a powerful database abstraction layer (DBAL). One of its key features is the option to write database queries in a proprietary object oriented SQL dialect called Doctrine Query Language (DQL), inspired by Hibernates HQL. This provides developers with a powerful alternative to SQL that maintains flexibility without requiring unnecessary code duplication.
When developing a Web application, it's standard practice to create a database structure on which server-side code is placed for the logic and UI layers. To connect to the database, the server-side code needs to do some basic creating, updating, deleting, and — most importantly — reading of records.
Why move from SQL to SPARQL?
There are many reasons why you would want to move from SQL to SPARQL. The details extend beyond the scope of this article, but you could be motivated by the following points:
You want a more distributed data solution.
You want to expose your data on the Web for people to use and link to.
You may find Node-Arc-Node relationships (triple) easier to understand than relational database models.
You may want to understand your data in a pure object-oriented fashion to work with an OOP paradigm (PHP V5 and later supports OOP).
You want to build generic agents that can connect to data sources on the Web.
"When developing a Web application, it's standard practice to create a database structure on which server-side code is placed for the logic and UI layers. To connect to the database, the server-side code needs to do some basic creating, updating, deleting
Prepare takes the $sql (with '?'s where data will go), along with the TYPES (array) of data to prepare the sql for, and a 3rd paramater for manipulating or result-getting (see next paragraph). It assigns this to $prepared_statement.
Another array is created with the data (in the same order as the types, of course), and the RESULT is aquired by running the execute() method on the $prepared_statement object, passing the execute method the "$data" array to fill in the '?'s
After this do everything as normal.
I have a feeling that MDB2 lower cases all field names - so you'll probably need :
echo $row['name']
A good idea would be to print_r($row) or similar, to see what's in it