Note: Anything within square brackets ([*]) is not required by default
Note: encode and decode functions are pretty much useless in any kind of production environment.
Connection initiation:
$mysql = new Database('127.0.0.1', 'pdoUser', 'userPass' [, 'dbName']);
Set the database if not provided earlier:
$mysql->setDB('dbName');
Insert info into a table:
$mysql->insert('table_name', array('column_1' => 'info_1' [, 'col2' => 'info2']));
Execute a query:
$mysql->query('update `lolcats` set `name`=:new where `name`=:old', array('new' => 'sweety', 'old' => 'cuteie'));
Execute a query, returning the rows selected:
$v = $mysql->fetch_array('select * from `users` where `username`=:user;', array('user' => 'Frankie\'s Dog'));
Hashing:
$hash = Database::hash('password');
if(Database::validate('password', $hash))
{
// Yippee you logged in ^.^
}
|