1. Go to this page and download the library: Download lajosbencz/pshd 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/ */
lajosbencz / pshd example snippets
$db = new PSHD\PSHD(array(
'dsn' => 'sqlite:/var/www/test.db',
));
// first column of first row in result set
$mixed = $select->cell();
// fifth column of first row in result set
$mixed = $select->cell(4);
// first row of result set, numeric indexes
$array = $select->row();
// first row of result set, associative indexes
$array = $select->assoc();
// first column of result set
$array = $select->column();
// fifth column of result set
$array = $select->column(4);
// complete result set
$array = $select->table();
// COUNT(*)
$int = $select->count();
class test_Model extends \PSHD\Model {
protected function _private() {
return array();
}
protected function _readonly() {
return array('id');
}
protected function _public() {
return array('col1','col2');
}
protected function _init() {
}
}
namespace \otherNS {
class other_Model extends \PSHD\Model {
// ...
}
}
$model = $db->model('test',5); // test_Model
$model = $db->select()->from('test')->where(5)->model(); // test_Model
$result = $db->result("SELECT col1,col2 FROM {P}test WHERE {I}=?",array(5));
$model = $result->model('otherNS\\other_Model',false); // other_Model
print $model->getId();
print $model['col1'];
print $model->col2;
$model->ool2 = 'new value';
$model->push();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.