Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/avil13/class.mysqli
php class to connect and using mysqli
https://github.com/avil13/class.mysqli
Last synced: 19 days ago
JSON representation
php class to connect and using mysqli
- Host: GitHub
- URL: https://github.com/avil13/class.mysqli
- Owner: avil13
- Created: 2013-03-18T01:07:16.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-03-28T17:43:58.000Z (over 10 years ago)
- Last Synced: 2024-10-11T17:18:13.763Z (about 1 month ago)
- Language: PHP
- Size: 117 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
**Connect with DataBase**
```
$conf = array();
$conf['host'] = 'localhost';
$conf['user'] = 'root';
$conf['pass'] = '';
$conf['db'] = 'db_name';$db = new DB($conf);
```#Do query#
**get 1 Array elements from table**
```
$res = $db->query("SELECT * FROM table")->fetch();
```**get value of name**
```
$res = $db->query("SELECT name FROM table WHERE id=2 ")->fetch('name');
```**get all Array elements from table**
```
$res = $db->query("SELECT * FROM table")->fetchAll();
```#Insert and Update#
```
$data = array('id'=>NULL, 'key'=>'value');
```**insert value in to the 'table'**
```
$db->insert('table', $data);
```**get last updated *id* **
```
$get_id = $db->id();
```**update data where id = 12 in 'table'**
```
$db->update('table', $data, $where = array('id'=>12));
```#Other#
clean ' and \`
```
$var = $db->clean('var');
```