SHARE
TWEET

Untitled

a guest Oct 12th, 2017 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. class MyDB extends SQLite3
  4. {
  5.     function __construct()
  6.     {
  7.         $this->open('test.sqlite');
  8.     }
  9. }
  10.  
  11. $db = new MyDB();
  12. if (!$db) {
  13.     echo $db->lastErrorMsg();
  14. } else {
  15.     echo "Opened database successfully\n";
  16. }
  17.  
  18. $sql = <<<EOF
  19.       INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY)
  20.       VALUES (5, 'Paul', 32, 'California', 20000.00 );
  21.  
  22.       INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY)
  23.       VALUES (6, 'Allen', 25, 'Texas', 15000.00 );
  24.  
  25.       INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY)
  26.       VALUES (7, 'Teddy', 23, 'Norway', 20000.00 );
  27.  
  28.       INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY)
  29.       VALUES (8, 'Mark', 25, 'Rich-Mond ', 65000.00 );
  30.  
  31.       INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY)
  32.       VALUES (9, 'Ieuan', 9, 'Brisbane ', 5000.00 );
  33. EOF;
  34.  
  35. $ret = $db->exec($sql);
  36. if (!$ret) {
  37.     echo $db->lastErrorMsg();
  38. } else {
  39.     echo "Records created successfully\n";
  40. }
  41. $db->close();
  42. ?>
RAW Paste Data
Top