static function create_list_page_get_limit_post($arr_query, $post_per_page) { $current_page = isset($_GET['paged']) ? $_GET['paged'] : 1; $arr_query['limit'] = array("start" => $post_per_page * $current_page - $post_per_page, "count" => $post_per_page); $db = new WA_Db(); $orders = $db->fetch($arr_query); return $orders; }
function wa_mails_user_bid($product_id) { require_once WA_PLUGIN_DIR . '/includes/class-wa-db.php'; $users = array(); $db = new WA_Db(); $arr_query = array("tableName" => "wa_product_bids AS a", "select" => "b.ID, a.price", "join" => array(array("tableName" => "users AS b", "on" => "b.id = a.user_id")), "where" => "a.product_id = " . $product_id, "groupByField" => "a.user_id"); $bid_users = $db->fetch($arr_query); if (count($bid_users) > 0) { foreach ($bid_users as $user) { array_push($users, array('user_id' => $user['ID'], 'price' => $user['price'])); } } return $users; }
function count_bid_by_productid($pID) { require_once WA_PLUGIN_DIR . '/includes/class-wa-db.php'; $db = new WA_Db(); $arr_query = array("tableName" => "wa_product_bids", "select" => "count(id) AS count", "where" => "product_id = " . $pID); $bid = $db->fetch($arr_query); return $bid[0]['count']; }