Zend Framework : Create Modular Application [Part 2]

SQL Code

CREATE  DATABASE  `MyApp` ;

Then under `MyApp`

CREATE TABLE IF NOT EXISTS `guestbook` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(30) NOT NULL,
`comment` text NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Using Zend_Tool configure Database

zf configure db-adapter "adapter=pdo_mysql&host=localhost&username=root&password=&dbname=MyApp"

Or add lines directly into application.ini

resources.db.adapter = "pdo_mysql"
resources.db.params.host = "localhost"
resources.db.params.username = "root"
resources.db.params.password = ""
resources.db.params.dbname = "MyApp"

Create a table (Model) for ‘MyApp.guestbook’ database

zf create db-table Guestbook guestbook Guestbook
/* zf create db-table Model-Name The-Table-Name Module-Name */

To Be continued

Comments (1)

ryy705August 7th, 2011 at 6:12 pm

Thank you. I learned more about ZendFramework module based development minutes on your site than I did in days reading through books and going through ZendFramework’s site.
Kindly continue this series.

Leave a comment

Your comment