I have already written about Zend framework. Its very nice open source framework for lazy programmers like me. You can find everything in the box.
Recently I studied Zend_Db_Table, and found it pretty helpful. After creating the database, you need to define a class for every table in the database as
class tablename extends Zend_DB_Table
{
}
Its important that tablename must match the table name in the database. It you don't want the class name to be similar to the table name in the database then define class as
class what_ever_name_you_want extends Zend_Db_Table
{
protected $_name='tablename'; // It's compulsory.
}
If you don't define the name as above, then you will encounter an error.
And that's it. you can now perform different operation like select, insert, delete etc without writing a single query.
if you want to fetch a single row then write
$object=new class_name();
$row=$object->fetchRow('conditon');// condition can be 'id=1';
The above code will now retrieve a single row from the table.
Similarly its very easy to update, insert and delete the data from the database.
If you are intrested you can visit Zend documentation.
Jul 14, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment