$sql = $empire->query ("Select Userid,agentid,username from member where Agentid= '". $user [UserID]. "' GROUP by UserID ') ;
while ($r = $empire->fetch ($sql))/* Get the records in the result set line by row, get the array row*/
{
$array []= $r;//Accept result set
}
Echo '
';
Print_r ($array);//print array No problem, it's an array.
Echo '
';
I would like to pass the above query $array this array to the following MySQL statement, what should be done. The group by UserID is used to classify, and the following MySQL statement is querying the database again, then classifying it according to the results categorized above.
$sql 2= $empire->query ("Select Userid,agentid,username from member where Agentid in ('). Implode (", Array_keys ($array)). ') GROUP by userid ");
Reply to discussion (solution)
$array Two-dimensional arrays
Array_keys ($array) only $array the first dimension subscript (0,1,2,3 ...).
$array Two-dimensional arrays
Array_keys ($array) only $array the first dimension subscript (0,1,2,3 ...).
How should I write this statement?
There is data in the while loop, but in the first statement there is no data $array.
What the hell do you want?
It's not going to work that hard.
What the hell do you want?
It's not going to work that hard.
This is the second query to connect the statement, so that you can query, I want to become a paragraph of the statement
Select UserID from member where Agentid in (select UserID from member where agentid= ' $user [userid] ' GROUP by userid) group by UserID
The second query results according to the first query classification, the second can write this statement, but the third query how to write, how long the statement ah
The results of the third query are categorized according to the second query
It's done.