Created
March 14, 2014 14:09
-
-
Save 0bp/9548383 to your computer and use it in GitHub Desktop.
SQLite3 FU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $db = new SQLite3('test.sqlite'); | |
| $db->exec('CREATE TABLE IF NOT EXISTS test (column1, column2, column3);'); | |
| $stmt = $db->prepare('INSERT INTO test (column1, column2, column3) values (:0, :1, :2)'); | |
| $data = array( | |
| array('a', 'b', 'c'), | |
| array('a', 'b', 'c'), | |
| array('x') | |
| ); | |
| foreach($data as $row) | |
| { | |
| foreach($row as $index => $column) | |
| { | |
| $stmt->bindValue(':'.$index, $column, SQLITE3_TEXT); | |
| } | |
| $stmt->execute(); | |
| $stmt->clear(); | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment