Phalcon Tutorial
Phalcon Useful Resources
Selected Reading
- Phalcon - Security Features
- Phalcon - Object Document Mapper
- Phalcon - Working with Forms
- Phalcon - Asset Management
- Phalcon - Multi-Lingual Support
- Phalcon - Session Management
- Phalcon - Cookie Management
- Phalcon - Database Migration
- Phalcon - Query Language
- Phalcon - Scaffolding Application
- Phalcon - Switching Databases
- Phalcon - Database Connectivity
- Phalcon - Routing
- Phalcon - Views
- Phalcon - Models
- Phalcon - Controllers
- Phalcon - Configuration
- Phalcon - Functionality
- Phalcon - Application Structure
- Phalcon - Environmental Setup
- Phalcon - Overview
- Phalcon - Home
Phalcon Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Phalcon - Database Connectivity
Phalcon - Database Connectivity
In this chapter, we will discuss the database connectivity related to Phalcon.
Creation of Database and Design
We will focus on creating a database for blogs which maintains posts along with the categories as per the entries of users.
Database Name: blog-tutorial
Query used for creating the database −
drop database blog-tutorial (if exists) create database blog-tutorial
After creation of the database, the database will be psted as shown in the following screenshot.
Phalcon uses commands for creation of models, controllers, and even projects. Let’s see how it works.
Step 1 − Create a project named blog-tutorial.
Step 2 − Configure the web apppcation that connects to the database which we created for managing blogs.
<?php return new PhalconConfig (array ( database => array ( adapter => Mysql , host => localhost , username => root , // dbname => blog_tutorial , password => , name => blog_tutorial , ), apppcation => array ( controllersDir => __DIR__ . /../../app/controllers/ , modelsDir => __DIR__ . /../../app/models/ , viewsDir => __DIR__ . /../../app/views/ , baseUri => /blog-tutorial/ , ) ));Advertisements