PHP code example of amkt922 / ssql
1. Go to this page and download the library: Download amkt922/ssql 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/ */
amkt922 / ssql example snippets
use SSql\SSql;
use SSql\SSql;
$config = array('database' => array('driver' => 'Sqlite' <- or Mysql
, 'dsn' => 'sqlite:./db/db.sqlite3'
, 'user' => ''
, 'password' => '')
'sqlDir' => './sql');
$ssql = SSql::connect($config);
$users = $ssql->createSQry()
->select(array('id', 'name'))
->from('User')
->where(array('name like' => 'sato'))
->execute();
$ssql = SSql::connect($this->config);
$users = $ssql->createSQry()
->delete()
->from('User')
->where(array('name like' => 'sato'))
->execute();
$ssql->createSQry()
->update('User')
->set(array('name' => 'kato'))
->where(array('id =' => 1))
->execute();
$ssql->createSQry()
->insert()
->into('User', array('id', 'name'))
->values(array(array(6, 'tanaka')))
->execute();
$ssql = SSql::connect($this->config);
$users = $ssql->createSSql()
->selectList('selectUser', array('id' => 1
, 'status' => 2
, 'paging' => true));
$ssql = SSql::connect($this->config);
$ssql->beginTransaction();
~~~~~~update data~~~~~~~~
if ($success) {
$ssql->commit();
} else {
$ssql->rollback();
}