-
Notifications
You must be signed in to change notification settings - Fork 3
Datebase
Nolan Chou edited this page May 26, 2015
·
6 revisions
use pt\framework\db as db;
$db = db::init();
// or
$db = \pt\framework\db::init();
$newconfig = array(
'dsn' => 'mysql:dbname=demo;host=localhost:3306',
'username' => 'root',
'password' => 'root',
'charset' => 'utf8',
);
$db = db::init($newconfig);
$row = $db -> prepare("SELECT * FROM `table` WHERE `id`=:id")
-> execute(array(':id'=>1));
If it's a select query, will return the selected rows;
A Update/Delete query, will return effect rows number;
A Insert query, will return last_insert_id or effect rows number;
$row2 = $db -> execute(array(':id'=>2));
- dns : pdo's DSN to connect to the database
- username
- password
- charset : default "utf8"
- License Agreement
- Change Log
- Welcome
- Server Requirements
- Getting Started
- Datebase
- Template
- Debug
- Route
- Log
- Language
- Dynamic expansion of class
- Callback
- Hook
- File
- Image
- Page
- String
- Upload
- Action (hook)
- Filter (hook)