I have a mysql table named tbl_member with the following datas
--------------------------------------------------------
mem_id fullname username refrl
--------------------------------------------------------
1 testing jerry01 0
--------------------------------------------------------
2 ebenezer ebenezery4 1
---------------------------------------------------------
3 aminat aminat 1
---------------------------------------------------------
4 olaniyi ebobofinger 2
---------------------------------------------------------
5 restoration restor 2
---------------------------------------------------------
6 adeyinka cmaster 3
---------------------------------------------------------
7 aledo akat02 3
---------------------------------------------------------
8 friday frayo 4
---------------------------------------------------------
9 ajoke ajoks 4
---------------------------------------------------------
10 femi lordfex 5
---------------------------------------------------------
什麼,我想我首先要做的查詢是從那裏的refrl是1,這意味着我希望得到的是被稱爲成員的名單TBL_MEMBER得到mem_id通過jerry01如何使用數組值來查詢的MySQL/MariaDB的
//這裏是我的查詢第一個查詢 $ bestid = 1;
$query_frst = "SELECT * FROM tbl_member WHERE refrl = :sess_id";
$stmt = $DB->prepare($query_frst);
$stmt->bindValue(":sess_id", $bestid);
$stmt->execute();
$r = $stmt->rowCount();
if($r>0){
while ($r = $stmt->fetch(PDO::FETCH_ASSOC)){
$id = $r['mem_id'];
//$N = count($id);
//for($i=0; $i < $N; $i++);
//echo $N;
echo $id;
}
}
的$ id將返回值2,3 即ebenezery4和aminat被jerry01
which are:
--------------------------------------------------------
mem_id fullname username refrl
--------------------------------------------------------
2 ebenezer ebenezery4 1
---------------------------------------------------------
3 aminat aminat 1
---------------------------------------------------------
現在我想做的事稱爲是我想查詢我的TBL_MEMBER找DATAS其中refrl是2,3次,這裏是我的查詢,我用
$queryy = "SELECT * FROM tbl_member WHERE refrl = :id";
$stmt = $DB->prepare($queryy);
$stmt->bindValue(":sess_id", $id);
$stmt->execute();
$remi = $stmt->rowCount();
if($remi>0){
echo"<table class='table table-bordered table-hover table-striped tablesorter'>";
echo"<thead>";
echo"<tr>";
echo"<th>Username</th>";
echo"<th>Fullname</th>";
echo"<th>Phone number</th>";
echo"<th>Current Stage</th>";
echo"<th>Level</th>";
echo"</tr>";
echo"</thead>";
echo"<tbody>";
while ($row1 = $stmt->fetch(PDO::FETCH_ASSOC)){
extract($row1);
echo"<tr>";
echo"<td>{$username}</td>";
echo"<td>{$fullname}</td>";
echo"<td>{$phoneno}</td>";
echo"<td>{$stage}</td>";
echo"<td>{$level}</td>";
echo"</tr>";
echo"</tbody>";
}
echo"</table>";
}else{
echo "<div class='alert alert-danger alert-dismissible fade in' role='alert' >You do not have any purchased product.</div>";
}
But my result return only the data of 3 which are the member referred by aminat alone
--------------------------------------------------------
mem_id fullname username refrl
--------------------------------------------------------
6 adeyinka cmaster 3
---------------------------------------------------------
7 aledo akat02 3
---------------------------------------------------------
instead of the values of 23 which should be
--------------------------------------------------------
mem_id fullname username refrl
--------------------------------------------------------
4 olaniyi ebobofinger 2
---------------------------------------------------------
5 restoration restor 2
---------------------------------------------------------
6 adeyinka cmaster 3
---------------------------------------------------------
7 aledo akat02 3
---------------------------------------------------------
i have tried to look for a way to solve it with my little understanding of php but i could not
我想要實現這個什麼是我
查看我添加的新標籤。 –