$sql= "select dd.* from (SELECT t1.id,t2.cus_id,t1.xd,t2.rate,t1.username FROM `tb_member`as t1 , schedule as t2
where t1.id=t2.cus_id and t1.id!=1 and t2.rate!=1 and remark not like('%1') ORDER BY RAND())as dd where xd !='1' limit 6 ";
echo $sql."</br>";
$result=mysql_db_query($db,$sql);
$count=mysql_num_rows($result);
while ($rec = mysql_fetch_array($result)){
echo $id= $rec['id'];
$idd[]= $rec['usernam'];
$user = $rec['username'];
$bb[$id][$j] = 2;
$idx2[] = $rec["id"];
echo $j."=>".$rec['username']."</br>";
}//while2
select dd.* from (SELECT t1.id,t2.cus_id,t1.xd,t2.rate,t1.username FROM `tb_member`as t1 , schedule as t2
where t1.id=t2.cus_id and t1.id!=1 and t2.rate!=1 and remark not like('%1') ORDER BY RAND())as dd where xd !='1' limit 6
$sql= "select * from (SELECT * FROM `tb_member` where id != 1 ORDER BY RAND() ) as dd where xc != '1' limit 6 ";
$result=mysql_db_query($db,$sql);
$count=mysql_num_rows($result);
while ($rec = mysql_fetch_array($result))
{
$id = $rec["id"];
$idx3[] = $rec["id"];
$idd2[]= $rec["username"];
$cc[$id][$j] = 3;
}