<?php // class file require 'BasicDB.php'; // connection $db = new \Erbilen\Database\BasicDB('localhost', 'testdb', 'testuser', 'password'); // select $query = $db->select('post')->join('users', '%s.user_id = %s.post_userid', 'left')->where('post_approval', 1)->or_where('post_approval', 2)->orderby('post_id', 'desc')->groupby('post_user')->limit(0, 10)->run(); if ($query) { foreach ($query as $row) { print_r($row); } }
<?php // class file require 'BasicDB.php'; // connection $db = new \Erbilen\Database\BasicDB('localhost', 'testdb', 'testuser', 'password'); // pagination example $totalRecord = $db->select('users')->from('count(user_id) as total')->total(); $pageLimit = 4; $pageParam = 'page'; $pagination = $db->pagination($totalRecord, $pageLimit, $pageParam); $query = $db->select('users')->orderby('user_id', 'DESC')->limit($pagination['start'], $pagination['limit'])->run(); print_r($query); echo $db->showPagination('http://localhost/test/?' . $pageParam . '=[page]');