目前我正在使用 php 和 mysql 来获取特定用户 ID 的下线。有什么办法我可以使用 mysql 来做到这一点。我的代码是......
function downlineSearch($mid, $s)
{
global $nums; global $str;
$q = $cn->query("SELECT userid, CONCAT(lastname,' ',firstname,' ',middlename) AS name FROM clientsdata WHERE (recid LIKE '%$s%' OR lastname LIKE '%$s%' OR firstname LIKE '%$s%' OR middlename LIKE '%$s%') AND sponsor = $mid");
while($r = $q->fetch_array(MYSQL_ASSOC))
{
$nums += 1;
$str .= "<tr><td valign='middle'>NRN".$r['userid']."CCN</td><td valign='middle'>".$r['name']."</td></tr>";
downlineSearch($r['userid'], $s);
}
}
$str = '';
downlineSearch($mid, 'janet');
echo '<table id="tblSearch" width="100%">';
echo "<tr><td colspan='4' align='center' style='padding-top:10px;'><h3> $nums records found for [ <span style='color:red'>".$_POST['s']."</span> ]</h3></td></tr>";
echo $str;
echo '</table>';`
任何帮助将不胜感激。谢谢