Intro | Zend Framework tutorial pdf

Zend Framework Database Step By Step Tutorial - Part 1: Zend Framework provides classes for supporting database. Name of that class is Zend_Db. More benefit using this class and its related classes is features that offer simple SQL database interface.
If we talk about database in Zend Framework, we may talk what is Zend_Db_Adapter. This is basic class you use to connect your PHP application to and RDBMS. As we know, there is a different adapter class for each brand of RDBMS. The Zend_Db_Adapters is a bridge from the vendor-specific PHP extensions to a common interface. With this class, you can write PHP application for multi brands of RDBMS (with little effort).
May be you remember there is extension at PHP that have function like Zend_Db_Adapter, PHP Data Object (PDO). PDO provide interface for multi database at PHP 5. At PHP 4, we know a library, ADOdb. About PHP ADOdb, you can read this post.
in this practice, we will use PDO for mysql (pdo_mysql). First try to check availabelity pdo_mysql in your system. Check in your php.ini. uncomment extension=php_pdo.dll,extension=php_pdo_mysql.dll, then restart your apache.
Ok, just remmembering, this practise base on our previous practice. So, make sure that you have followed that practice.
For this practice, create a database named "zend". Then create a table named "user".
You can use this query:
CREATE TABLE `user` (
`id` int(11) NOT NULL auto_increment,
`first_name` varchar(50) NOT NULL,
`last_name` varchar(50) NOT NULL,
`user_name` varchar(50) NOT NULL,
`password` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `user_name` (`user_name`)
);

0 comments: