Echo89

My PHP Framework database module usage example.

Sep 24th, 2013
51
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Connect
  2. $db = F("database/connect", array("localhost", "root", ""))->message;
  3. $db->selectDatabase("framework");
  4.  
  5. $query = $db->newQuery()->message;
  6.  
  7. $query->create("hello_table", array(
  8.     "id" => "INT NOT NULL AUTO_INCREMENT",
  9.     "name" => "VARCHAR(50) DEFAULT ''"
  10. ), "id"); // Primary key
  11. $db->execQuery($query);
  12.  
  13. $query->reset()->insert("hello_table", array(
  14.     "name" => "Caelan Stewart")
  15. );
  16. $db->execQuery($query);
  17.  
  18. // Close connection
  19. $db->close();
RAW Paste Data