diff --git a/docs/guide/start-databases.md b/docs/guide/start-databases.md index a71736dbfc..665f595a3a 100644 --- a/docs/guide/start-databases.md +++ b/docs/guide/start-databases.md @@ -1,31 +1,56 @@ Working with Databases ====================== -> Note: This section is under development. - In this section, we will describe how to create a new page to display data fetched from a database table. -To achieve this goal, you will create an [action](structure-controllers.md), a [view](structure-views.md), -and an [Active Record](db-active-record.md) model that can be used to fetch and represent database data. +To achieve this goal, you will configure the database connection, create an [Active Record](db-active-record.md) class +to fetch and represent database data, and then create an [action](structure-controllers.md) and +a [view](structure-views.md) to present the data to end users. Through this tutorial, you will learn -* How to configure database connections; +* How to configure DB connections; * How to define an Active Record class; * How to query data using the Active Record class; * How to display data in a view in a paginated fashion. +Note that in order to finish this section, you should have basic knowledge and experience about databases. +You should know how to create a database and how to execute SQL statements using a DB client tool. + + +Configuring a Database Connection +--------------------------------- + +To start, you should have a database ready. It can be a SQLite, MySQL, PostgreSQL, MSSQL or Oracle database. +For simplicity, in the following description, we will assume that you already have a MySQL database named `basic`. + +Create a table named `address` and insert some sample data. The SQL statements are showing as follows, + +```sql +CREATE TABLE `address` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `street` varchar(128), + `city` varchar(128), + `state` varchar(128), + `country` varchar(128) +); +``` + + +Creating an Active Record +------------------------- -Creating a Model ----------------- Creating an Action ------------------ + Creating a View --------------- + How It Works ------------ + Summary ------- diff --git a/docs/guide/start-forms.md b/docs/guide/start-forms.md index 305ce9c235..aff2c93b90 100644 --- a/docs/guide/start-forms.md +++ b/docs/guide/start-forms.md @@ -1,8 +1,6 @@ Working with Forms ================== -> Note: This section is under development. - In this section, we will describe how to create a new page to get data from users. The page will display a form with a name input field and an email input field. After getting these data from a user, the page will echo them back to the user for confirmation.