add SQLite3 PHP example
This commit is contained in:
parent
75e3463ec7
commit
b0dc89a18e
@ -6,6 +6,10 @@ charset = utf-8
|
|||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.php]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
[{*.html,*.css}]
|
[{*.html,*.css}]
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
indent_size = 4
|
indent_size = 4
|
||||||
|
1
PHP/Fenom.md
Normal file
1
PHP/Fenom.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
# Fenom
|
@ -2,3 +2,7 @@
|
|||||||
|
|
||||||
## std
|
## std
|
||||||
- [`gettype`](gettype.php) - Get the type of a variable
|
- [`gettype`](gettype.php) - Get the type of a variable
|
||||||
|
- [`SQLite3`](sqlite3.php) - Простой использования класса SQLite3
|
||||||
|
|
||||||
|
## Libs
|
||||||
|
- [`Fenom`](Fenom.md) - fenom
|
||||||
|
21
PHP/sqlite3.php
Normal file
21
PHP/sqlite3.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Простой пример расширения класса SQLite3 и изменения параметров конструктора.
|
||||||
|
* После чего использование метода open для инициализации БД.
|
||||||
|
*/
|
||||||
|
class MyDB extends SQLite3
|
||||||
|
{
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
$this->open('mysqlitedb.db');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = new MyDB();
|
||||||
|
|
||||||
|
$db->exec('CREATE TABLE foo (bar STRING)');
|
||||||
|
$db->exec("INSERT INTO foo (bar) VALUES ('This is a test')");
|
||||||
|
|
||||||
|
$result = $db->query('SELECT bar FROM foo');
|
||||||
|
var_dump($result->fetchArray());
|
||||||
|
?>
|
Loading…
x
Reference in New Issue
Block a user