phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


Zend Framework Database: Intro

Tag: framework, zend, zend framework, database   Category: PHP Framework
post: 12 Apr 2008 read: 2,880


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 at here and here. 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`)
);


Series this article:
Zend Framework Database: Intro
Zend Framework Database: Creating Input Form
Zend Framework Database: Inputing Data to Database
Zend Framework Database: Inserting Expressions to a table
Zend Framework Database: Creating List of Data
Zend Framework Database: Creating Editing Form
Zend Framework Database: Updating Data
Zend Framework Database: Updating Data Use Update Query From Zend Framework
Zend Framework Database: Deleting Data
Zend Framework Database: Delete Query Style
Zend Framework Database: Summarizing Action Controller

| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
mod_rewrite - Part 1: create your "fantasy" URL

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


615
posting