<?php
require_once("../check.php");
?>
<!DOCTYPE html><head>
<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="../js/jquery-1.11.1.min.js"></script>
<script src="../jquerymoblie/jquery.mobile-1.4.1.min.js"></script>
<link rel="stylesheet" href="../jquerymoblie/jquery.mobile-1.4.1.min.css"/>
<style>

#alert{
    display:none;
    margin-top:100px;
    color:#FFFF00;
    z-index:100;
    position: absolute;
    width:100%;
    font-size:14px;
    height:60px;
    line-height:60px;
    background-color: #FF671E;
    border-radius:10px;
    text-align:center;
}
table {
border:0;
border-collapse:collapse; border-spacing:0;
}
table tr{
border-width:0px 0px 0px 0px;
}
table tr td{
    border-width:0px 0px 0px 0px;
    border-bottom:1px solid #D5D5D5;
    font-size:14px;
    color: #8F8F8F;
    line-height:35px;
}
table tr th{
    color: #7B7B7B;
}
#pageye{
    width:95%;
    margin-left:auto;
    margin-right:auto;
    height:40px;
    line-height:40px;
}
#pageye .left{
    float:left;
    width:50%;
    text-align:center;
}
#pageye a{
    text-decoration:none;
    font-size:16px;
    
}
</style>


<div data-role="page" id="pageone">
  <div data-role="header">
    <h1>我的徒弟</h1>
</div>
<div data-role="content" style="text-align: center;">
<?php
//读取自己上级的信息
$unionuid = $u['unions'];
if($unionuid>="1"){
$abcsql = "select * from dunling_menber where id='$unionuid'";
$unionery = mysql_query($abcsql,$config);
$unioninfo = mysql_fetch_array($unionery);
$union_weixin = $unioninfo['weixin'];
$union_moblie = $unioninfo['username'];
if($union_weixin==null){
    $info = $union_moblie;
}else{
    $info = $union_weixin;
}


}
/////////////////////////////////////////////////////

//调用变量 $info 为上级的微信或手机号，自动判断
//调用上级的ID 变量为  $unionid;
//////////////////////////////////////////////////

ini_set("date.timezone","PRC");
$m="10";//每页显示的记录数
isset($_GET['page'])?$page=$_GET['page']:$page="1";//当前页数
$numsql = "select count(id) as num from dunling_menber where unions='$uid' ";
$numery = mysql_query($numsql,$config);
$numery = mysql_fetch_array($numery);
$zongjilushu = $numery['num'];//总记录数
$zy = (int)(($zongjilushu-1)/$m)+1;//总页数
$one = (int)($page-1)*$m;//当前页的首条记录
$articlesql = "select * from dunling_menber where unions='$uid' order by id desc limit $one,$m";
$articleery = mysql_query($articlesql,$config);
if($xiaxianrenshu=="0"){
        echo '您当前没有徒弟!';
}else{
echo '<table width="100%" border="0"><tr><th>昵称</th><th>余额</th><th>总收益</th></tr>';
while($list = mysql_fetch_array($articleery)){
$nicheng  = $list['nicheng'];
$moneypay = $list['moneypay'];
$money = $list['money'];

    echo '<tr>';
    echo '<td>';
    echo $nicheng;
    echo '</td>';
    echo '<td>';
    echo $moneypay;
    echo '</td>';
    echo '<td>';
    echo $money;
    echo '</td>';
    echo '</tr>';
}
echo '</table>';
}
?>

</table>
</div>



<div id="pageye">
<?php
$shangyiye = $page-"1"."&unions=".$unions;
$xiayiye = $page+"1"."&unions=".$unions;
if($page>"1"){
  echo '<div class="left"><a href="?page='.$shangyiye.'">上一页</a></div>';  
}
if($page<$zy){
  echo '<div class="left"><a href="?page='.$xiayiye.'">下一页</a></div>';  
}
?>
</div>
</div>