- CodeIgniter Web Application Blueprints
- Rob Foster
- 243字
- 2021-08-06 19:34:29
Creating the database
Okay, you should have already set up CodeIgniter and Bootstrap as described in Chapter 1, Introduction and Shared Project Resources. If not, then you should know that the code in this chapter is specifically built with the setup from Chapter 1, Introduction and Shared Project Resources, in mind. However, it's not the end of the world—the code can easily be applied to other situations.
Firstly, we'll build the database. Copy out the following MySQL code into your database:
CREATE DATABASE `urls`; USE `urls`; CREATE TABLE `urls` ( `url_id` int(11) NOT NULL AUTO_INCREMENT, `url_code` varchar(10) NOT NULL, `url_address` text NOT NULL, `url_created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`url_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
Let's take a look at what each item in the database means:

We'll also need to make amends to the config/database.php
file—namely setting the database access details, username password, and so on.
Open the config/database.php
file and find the following lines:
$db['default']['hostname'] = 'localhost'; $db['default']['username'] = 'your username'; $db['default']['password'] = 'your password'; $db['default']['database'] = 'urls';
Edit the values in the preceding lines. Ensure you substitute those values with the ones that are more specific to your setup and situation—so enter your username, password, and so on.
- Implementing VMware Horizon 7(Second Edition)
- Boost程序庫完全開發指南:深入C++”準”標準庫(第5版)
- LabVIEW 2018 虛擬儀器程序設計
- DevOps for Networking
- Python王者歸來
- TypeScript圖形渲染實戰:基于WebGL的3D架構與實現
- 軟件架構:Python語言實現
- Linux操作系統基礎案例教程
- Building RESTful Python Web Services
- 硅谷Python工程師面試指南:數據結構、算法與系統設計
- 持續輕量級Java EE開發:編寫可測試的代碼
- 編寫高質量代碼:改善Objective-C程序的61個建議
- Swift語言實戰晉級
- Java程序設計教程
- Java自然語言處理(原書第2版)