PHP code example of devnull-ir / db-php
1. Go to this page and download the library: Download devnull-ir/db-php library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
devnull-ir / db-php example snippets
$cn = connect('dbName','myuser','passworduser');
$db = new db(string $dbname,string $username_db,string $password_db,string $host = 'localhost');
$Option = [
PDO::ATTR_PERSISTENT => TRUE,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::MYSQL_ATTR_INIT_COMMAND =>'SET NAMES utf8',
PDO::ATTR_EMULATE_PREPARES => false
];
$pdo = new PDO("mysql:host=localhost;dbname=dmn_nm;charset=utf8", "myAdmin" , 'abcdefgh1234' , $Option );
$select = select($cn, '*','db',['id'=>10],'limit 3');
select($cn, '*','db',['id'=>10,['coin','>=',15]]);
select($cn, '*','db');
like($cn, '*','Customers',[
'CustomerName'=>'a%'
]);
like($cn, '*','db',[
'column'=>"a%"
],
[
[
'id','<=',15
]
]);
like($cn, '*','db',[
'column'=>"a%"
],
[
'id'=>15
]);
select($cn, 'MIN(Price) AS SmallestPrice','Products');
select($cn, 'Orders.OrderID, Customers.CustomerName','Orders INNER JOIN Customers ON Orders.CustomerID = Customers.CustomerID');
insert($cn, 'table',['one'=>'one','tow'=>'tow','there'=>'there']);
deleted($cn, 'one',['p'=>12]);
update($cn, 'tb',['id'=>12],['name'=>14]);
table($cn, 'accounts',['id'=>'int']);
unique($cn, 'articles',['slug']);
primary($cn, 'accounts',['token']);
drop($cn, 'table',['column']);
drop($cn, ['a','b']);
autoIncrement($cn, 'TableNabe','columnName');
$db->autoIncrement('TableNabe','columnName');
array
array (size=2)
'count' => int 3
'fetchAll' =>
array (size=3)
0 =>
array (size=7)
'id' => int 17
'step' => string 'support' (length=7)
'chat_id' => int 1212
'Cash' => null
'vip' => int 0
'grade' => int 0
'Download' => int 0
1 =>
array (size=7)
'id' => int 18
'step' => string 'NewUser' (length=7)
'chat_id' => int 1016239559
'Cash' => null
'vip' => int 0
'grade' => int 0
'Download' => int 0
2 =>
array (size=7)
'id' => int 19
'step' => string 'NewUser' (length=7)
'chat_id' => int -663757927
'Cash' => null
'vip' => int 0
'grade' => int 0
'Download' => int 0