i have two table wp_wcfm_marketplace_orders wp_wcfm_affiliate_orders
i need call data where wp_wcfm_affiliate_orders.orderid wp_wcfm_marketplace_orders.order_id
it code call data table wp_wcfm_affiliate_orders
public function processing() {
global $WCFM, $wpdb, $_POST, $WCFMu, $WCFMaf;
$length = $_POST['length'];
$offset = $_POST['start'];
$affiliate_id = $_POST['wcfm_affiliate'];
$status = $_POST['status_type'];
$sql = "SELECT COUNT(ID) FROM `{$wpdb->prefix}wcfm_affiliate_orders`";
$sql .= " WHERE 1=1";
$sql .= " AND {$wpdb->prefix}wcfm_affiliate_orders.affiliate_id = {$affiliate_id}";
if( $status ) $sql .= " AND {$wpdb->prefix}wcfm_affiliate_ordersmission_status = '{$status}'";
$sql .= ' AND `is_trashed` = 0';
$affiliate_count = $wpdb->get_var( $sql );
// Get Product Count
$sql = "SELECT * FROM {$wpdb->prefix}wcfm_affiliate_orders ";
$sql .= " WHERE 1=1";
$sql .= " AND {$wpdb->prefix}wcfm_affiliate_orders.affiliate_id = {$affiliate_id}
";
if( $status ) $sql .= " AND {$wpdb->prefix}wcfm_affiliate_ordersmission_status = '{$status}'";
$sql .= ' AND `is_trashed` = 0';
$sql .= " ORDER BY `ID` DESC";
$sql .= " LIMIT {$length}";
$sql .= " OFFSET {$offset}";
$wcfm_affiliate_orders_array = $wpdb->get_results( $sql );
$wcfm_affiliate_order_count = count( $wcfm_affiliate_orders_array );
i have two table wp_wcfm_marketplace_orders wp_wcfm_affiliate_orders
i need call data where wp_wcfm_affiliate_orders.orderid wp_wcfm_marketplace_orders.order_id
it code call data table wp_wcfm_affiliate_orders
public function processing() {
global $WCFM, $wpdb, $_POST, $WCFMu, $WCFMaf;
$length = $_POST['length'];
$offset = $_POST['start'];
$affiliate_id = $_POST['wcfm_affiliate'];
$status = $_POST['status_type'];
$sql = "SELECT COUNT(ID) FROM `{$wpdb->prefix}wcfm_affiliate_orders`";
$sql .= " WHERE 1=1";
$sql .= " AND {$wpdb->prefix}wcfm_affiliate_orders.affiliate_id = {$affiliate_id}";
if( $status ) $sql .= " AND {$wpdb->prefix}wcfm_affiliate_ordersmission_status = '{$status}'";
$sql .= ' AND `is_trashed` = 0';
$affiliate_count = $wpdb->get_var( $sql );
// Get Product Count
$sql = "SELECT * FROM {$wpdb->prefix}wcfm_affiliate_orders ";
$sql .= " WHERE 1=1";
$sql .= " AND {$wpdb->prefix}wcfm_affiliate_orders.affiliate_id = {$affiliate_id}
";
if( $status ) $sql .= " AND {$wpdb->prefix}wcfm_affiliate_ordersmission_status = '{$status}'";
$sql .= ' AND `is_trashed` = 0';
$sql .= " ORDER BY `ID` DESC";
$sql .= " LIMIT {$length}";
$sql .= " OFFSET {$offset}";
$wcfm_affiliate_orders_array = $wpdb->get_results( $sql );
$wcfm_affiliate_order_count = count( $wcfm_affiliate_orders_array );
Share
Improve this question
edited Dec 7, 2019 at 19:14
l3lmk
asked Dec 7, 2019 at 18:40
l3lmkl3lmk
214 bronze badges
1
- Welcome to WordPress Development. I hope you find the answer(s) you are looking for. Our site is different from most - if you have not done so yet, consider checking out the tour and help center to find out how things work. – Matthew Brown aka Lord Matt Commented Dec 8, 2019 at 12:12
1 Answer
Reset to default 0// Get Product Count $sql = "SELECT wcfm_affiliate_orders.*, ya.order_id,ya.order_status FROM {$wpdb->prefix}wcfm_affiliate_orders AS wcfm_affiliate_orders LEFT JOIN {$wpdb->prefix}wcfm_marketplace_orders AS ya ON ya.order_id = wcfm_affiliate_orders.order_id "; $sql .= " WHERE 1=1"; $sql .= " AND wcfm_affiliate_orders.affiliate_id = {$affiliate_id}
";
if( $status ) $sql .= " AND wcfm_affiliate_ordersmission_status = '{$status}'";
$sql .= " ORDER BY wcfm_affiliate_orders.ID DESC";
$sql .= " LIMIT {$length}";
$sql .= " OFFSET {$offset}";
$wcfm_affiliate_orders_array = $wpdb->get_results( $sql );
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744925757a4601425.html
评论列表(0条)