PHP Classes

File: readme

Recommend this page to a friend!
  Classes of Legend Foxy   PDO Wrapper Sky's flavor   readme   Download  
File: readme
Role: Documentation
Content type: text/plain
Description: examples
Class: PDO Wrapper Sky's flavor
Access MySQL databases using PDO
Author: By
Last change:
Date: 10 years ago
Size: 897 bytes
 

Contents

Class file image Download
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 ^.^ }