Php 此函数返回localhost上的分页,但当我在网站上上载时,分页不起作用
我用于数据显示的查询 $sql=SELECT*FROM$wpdb->postETA wpmeta内部连接$wpdb->posts wp ON wpmeta.post\u id=wp.id,其中wpmeta.meta\u value='.$current\u user->id.' 和wpmeta.meta\u key=''u customer\u user'和wp.post\u type='shop\u order'和wp.post\u status='wc-processing'组(按wp.ID); IFAsset$\u请求['submit']{ $applct\u name=$\u请求['applct\u name']; $applct_email=$_请求['applct_email']; $applct\u msg=$\u请求['applct\u msg']; $product\U name=$\U请求['product\U name']; $product\U number=$\U请求['product\U number']; $current\u user=wp\u get\u current\u user; $usermeta=array 'name'=>$applct\u name, “email”=>$applct\u email, “产品名称”=>$product\U name, 'message'=>$applct\u msg )Php 此函数返回localhost上的分页,但当我在网站上上载时,分页不起作用,php,wordpress,pagination,Php,Wordpress,Pagination,我用于数据显示的查询 $sql=SELECT*FROM$wpdb->postETA wpmeta内部连接$wpdb->posts wp ON wpmeta.post\u id=wp.id,其中wpmeta.meta\u value='.$current\u user->id.' 和wpmeta.meta\u key=''u customer\u user'和wp.post\u type='shop\u order'和wp.post\u status='wc-processing'组(按wp.ID
function get_product_detail(){
global $woocommerce, $wpdb, $current_user;
$user = $current_user->ID;
我已经打印了所有变量它显示的值您能解释一下Conrad LotzI会假设您本地PC和主机服务器上的身份验证凭据不同。即数据库主机、用户和密码?但在站点上显示列表的功能相同,只是分页不起作用,
$flag = 0;
if($flag==0){
add_user_meta($user, 'applicant_invite_by', $usermeta);
$headers = 'From: Backcheckgroup.com <noreply@backcheckgroup.com>' . "\r\n";
wp_mail( $applct_email, 'Verfication Required', $applct_msg, $headers);
$flag=1;
echo 'Form submited';
}else{
echo 'Already submited';
}
}
echo '<table class="order_detail">';
echo '<tr>
<th>No.</th>
<th>Product ID</th>
<th>Product Name</th>
<th>invite user</th>
<th>Status</th>
</tr><tbody>';
$query = $wpdb->query($sql);
$total = $query;
$items_per_page = 3;
$page = isset( $_GET['cpage'] ) ? abs( (int) $_GET['cpage'] ) : 1;
$offset = ( $page * $items_per_page ) - $items_per_page;
$service = $wpdb->get_results( $sql . " LIMIT ".$offset.", ".$items_per_page."" );
foreach( $service as $results ) {
$orderID = $results->post_id;
$order = new WC_Order($orderID);
$status = $order->status;
$order_items = $order->get_items();
if(count($order_items))
{
$j=1;
foreach($order_items as $item){
$item_name = $item['name'];
$product_id = $item['product_id'];
$qty = $item['qty'];
echo '<tr class="collaps"><th><span>+</span></th><th>'.$product_id.'</th><th>'.$current_user->billing_first_name.' / '.$current_user->billing_company.'</th><th>Invited(0/'.$qty.')</th><th>Completed(0/'.$qty.')</th></tr>';
for($i=1; $i <=$qty; $i++){
$numbers = rand(0,100);
echo '<tr class="sub-rows"><td>'.$j.'</td>';
echo '<td>'.$product_id.'</td>';
echo '<td>'.$item_name.'</td>';
echo '<td><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal_'.$numbers.'">invite</a></td>';
popup($numbers, $qty, $item_name, $user, $product_id);
$j++;
echo '<td>'.$status.'</td></tr>';
}
}
}
}
echo '</tbody></table>';
echo 'Pagination'.paginate_links( array(
'base' => add_query_arg( 'cpage', '%#%' ),
'format' => '',
'prev_text' => __('«'),
'next_text' => __('»'),
'total' => ceil($total / $items_per_page),
'current' => $page
));
return $data;
}