我有两张表格wp\\u wcfm\\u marketplace\\u orderswp\\u wcfm\\u affiliate\\u orders
我需要wp\\u wcfm\\u affiliate\\u订购的呼叫数据。orderid wp\\u wcfm\\u marketplace\\u订单。order\\u id
it代码调用数据表wp\\U wcfm\\U affiliate\\U 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_orders.commission_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_orders.commission_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 );