1. Go to this page and download the library: Download uzulla/cfedb2 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/ */
uzulla / cfedb2 example snippets
$post = new Post();
$post->val('text', 'this is text');
$post->val('num', 123);
$post->saveItem();
$post2 = Post::getById(1);
echo $post2->val('text');
$post3 = Post::getBySome('text', 'this is text');
if(empty($post3)){
echo "not found";
}
$post_list = Post::getsBySQL('SELECT * FROM post WHERE id>:id', array('id'=>5));
if(empty($post_list)){
echo "not found";
}
foreach($post_list as $p){
echo $p->val('id');
}
$post->deleteItem();
//もし貴方がROWオブジェクト嫌いなら…
$post_list = Post::getsHashBySome('text', 'this is text');
s Post extends \Uzulla\CFEDb2{
static $tablename = 'post';
static $pkeyname = 'id';
public function __construct() {
$this->values['id'] = null;
$this->values['text'] = null;
$this->values['num'] = null;
$this->values['created_at'] = null;
$this->values['updated_at'] = null;
}
public function as_you_like(){
return $this->val('id').' as you like!';
}
static function getMySpecial(){
return static::getById(3);
}
}