note 105276 added to language.functions
| From: | harenatnajupaldotcom at osu1 dot php dot net | Date: | Sat, 06 Aug 2011 15:23:36 +0000 |
| Subject: | note 105276 added to language.functions | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-182282@lists.php.net to get a copy of this message | ||
Can any one tell me that what should I use in my function below. I want to get left right total
downline of a special ID. coloum left contains left downline id and coloum right contain right
downline id. MLM Binary plan.
<?php
//My Codes============
class data{
function countchild($id, $mid){
$sql=mysql_fetch_row(mysql_query("SELECT
right FROM member_login WHERE
id='$id'"));
if($sql['0'] >'0'){
$this->nodel($sql['0'], $mid=1);
}
else echo "0";
}
function nodel($id, $mid){
$sql=mysql_fetch_row(mysql_query("SELECT left,right FROM
member_login WHERE id='$id' and (left > '0' or
right > '0')"));
if($sql['0'] > 0 && $sql['1']>0){
$mid=$mid+2;
}
elseif($sql['0'] > 0 or $sql['1']>0){
$mid=$mid+1;
}
if($sql['0'] <= 0 && $sql['1'] <= 0)
{
echo $mid;
}
function noder($id, $mid){
$sql=mysql_fetch_row(mysql_query("SELECT left,right FROM
member_login WHERE id='$id' and (left > 0 or right >
0)"));
if($sql['0'] >'0' && $sql['1'] >'0')
{
$mid=$mid+1;
}
elseif($sql['0'] >'0' or $sql['1'] >'0'){
$mid=$mid+2;
}
if($sql['1'] >'0'){
$this->noder($sql['1'], $mid);
}
else
{
echo $mid+1;
}
}
}
}
$data=new data;
echo $data->countchild('1', '0')."<br>";
?>
----
Server IP: 69.147.83.197
Probable Submitter: 121.245.81.78
----
Manual Page -- http://www.php.net/manual/en/language.functions.php
Edit -- https://master.php.net/note/edit/105276
Del: integrated -- https://master.php.net/note/delete/105276/integrated
Del: useless -- https://master.php.net/note/delete/105276/useless
Del: bad code -- https://master.php.net/note/delete/105276/bad+code
Del: spam -- https://master.php.net/note/delete/105276/spam
Del: non-english -- https://master.php.net/note/delete/105276/non-english
Del: in docs -- https://master.php.net/note/delete/105276/in+docs
Del: other reasons-- https://master.php.net/note/delete/105276
Reject -- https://master.php.net/note/reject/105276
Search -- https://master.php.net/manage/user-notes.php