<?
session_start();
include("connectdb.php");
mysql_select_db("gano",$con) or die ("ไม่พบฐานข้อมูล");
$str_sql="SELECT * FROM user WHERE gano_id='" . $_SESSION['gano_id'] . "'";
$sum1=0;
$total1=0;
$result=mysql_query($str_sql,$con) or die("โค๊ด $str_sql ผิด");
while($row=mysql_fetch_array($result)){
echo $row["user_id"] . "<br/>";
$str_sql="SELECT * FROM user WHERE upline='" . $row['gano_id'] . "'";
$result_upline1=mysql_query($str_sql,$con) or die("โค๊ด $str_sql1 ผิด");
while($row_upline1=mysql_fetch_array($result_upline1)){
echo $row_upline1["user_id"] . "<br/>";
$str_sql2="SELECT * FROM user WHERE upline='" . $row_upline1['gano_id'] . "'";
$result_upline2=mysql_query($str_sql2,$con) or die("โค๊ด $str_sql1 ผิด");
while($row_upline2=mysql_fetch_array($result_upline2)){
echo $row_upline2["user_id"] . "<br/>";
$str_sql3="SELECT * FROM user WHERE upline='" . $row_upline2['gano_id'] . "'";
}
}
}
?>
$str_sql="SELECT * FROM user WHERE upline='" . $row['gano_id'] . "' order by user_id ASC"; Code (PHP)
<?
session_start();
include("connectdb.php");
mysql_select_db("gano",$con) or die ("ไม่พบฐานข้อมูล");
$str_sql="SELECT * FROM user WHERE gano_id='" . $_SESSION['gano_id'] . "'";
$sum1=0;
$total1=0;
$result=mysql_query($str_sql,$con) or die("โค๊ด $str_sql ผิด");
while($row=mysql_fetch_array($result)){
echo $row["user_id"] . "<br/>";
$str_sql="SELECT * FROM user WHERE upline='" . $row['gano_id'] . "'";
$result_upline1=mysql_query($str_sql,$con) or die("โค๊ด $str_sql1 ผิด");
while($row_upline1=mysql_fetch_array($result_upline1)){
echo $row_upline1["user_id"] . "<br/>";
$str_sql2="SELECT * FROM user WHERE upline='" . $row_upline1['gano_id'] . "'";
$result_upline2=mysql_query($str_sql2,$con) or die("โค๊ด $str_sql1 ผิด");
while($row_upline2=mysql_fetch_array($result_upline2)){
echo $row_upline2["user_id"] . "<br/>";
$str_sql3="SELECT * FROM user WHERE upline='" . $row_upline2['gano_id'] . "'";
}
}
}
?>