File Name: functions.php
Code: Select all
<?php
/*
This is the main file of this tree project
here in this file the DIV is created according to the member ID and it is concanate to the placement_type as well
for eg if the member id is 1 and the placement type is L then the div id = 1L
This page is called from the Tree1.php for first time
and it will show the below table with 2 respected links L and R (only if he had a sub member)
and when click on this 2 links they will call javascript function named "showhint" with URL and the ID of the member and DIV ID (1L or 1R)
well this showhint function is in script1.js file it will call the ajaxreturn.php file along with URL and the Div ID
*/
function main_box($sql=null){
global $obj;
$obj->query($sql);
while ($result = $obj->query_fetch(1)){
$id=$result['id'];
$name=$result['name'];
$pid=$result['parent_id'];
$lr=$result['placement_type'];
$img=$result['img_path'];
$legs='images/l1.jpg';
}
?>
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" bordercolor="#CCCCCC">
<tbody>
<tr>
<td width="378" valign="top"> </td>
<td width="20" valign="top"> </td>
<td width="19" valign="top"> </td>
<td width="376" valign="top"> </td>
</tr>
<tr>
<td width="378"> </td>
<td align="center" colspan="2" border="0" nowrap>
<img src="<?php echo $img; ?>"><br />
<?php echo $name; ?><br>
<img src="<?php echo $legs; ?>">
</td>
<td valign="top" width="376"> </td>
</tr>
<tr>
<td> </td>
<td valign="top" border="0">
<?php
$sql="SELECT * FROM tbl_tree WHERE parent_id=$id AND placement_type='L'";
$obj->query($sql);
while ($result = $obj->query_fetch(1)){
$left=true;
}
if ($left){
$leftCount=$leftCount+1;
$idl=$id."l";
main_box($sql);
}
?> </td>
<td valign="top" border="0">
<?php
$sql="SELECT * FROM tbl_tree WHERE parent_id=$id AND placement_type='R'";
$obj->query($sql);
while ($result = $obj->query_fetch(1)){
$right=true;
}
if ($right){
$rightCount=$rightCount+1;
$idr=$id."r";
main_box($sql);
}
?> </td>
<td width="200" valign="top"> </td>
</tr>
<tr>
<td valign="top" align="middle" colspan="1"><div id="<?php echo $idl; ?>"> </div></td>
<td valign="top" align="middle" colspan="1"><div id="<?php echo $idr; ?>"> </div></td>
</tr>
</tbody>
</table>
<?php
} // function Close
?File Name: ViewDownline.php
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Tree Structure </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
include ("include/host_conf.php");
include ("include/mysql.lib.php");
$obj=new connect();
include ("functions.php");
$sn=1; // You can change this value to see the tree related to this member
if(empty($sn)) {
$sn=1;
}
$sql="SELECT * FROM tbl_tree WHERE id=$sn";
main_box($sql);
?>
</body>
</html>i hope any one can help me to solve this issue. Thanks in Advance.
pickle | Please use [ code=php ], [ code=text ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: