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: 6 years ago
Size: 897 bytes



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('', 'pdoUser', 'userPass' [, 'dbName']);

Set the database if not provided earlier:

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'));

  $hash = Database::hash('password');
  if(Database::validate('password', $hash))
    // Yippee you logged in ^.^

For more information send a message to info at phpclasses dot org.