for now I am doing my thing with this heavy code :
$arrayid = array();
$req = $mysqli->query("SELECT * FROM sc_users_teaching WHERE lesson = '_ADOBE_PHOTOSHOP_' ORDER BY lesson DESC");
while($liste_resultat = $req->fetch_assoc()) {
$ID_USER = $liste_resultat['ID_USER'];
$req_user = $mysqli->query("SELECT * FROM sc_users WHERE ID_USER = '$ID_USER' LIMIT 0,1");
$liste_user = $req_user->fetch_assoc();
$lastconnexion = $liste_user['lastconnexion'];
$arrayid[$ID_USER] = $lastconnexion;
}
arsort($arrayid);
foreach ($arrayid as $key => $val) {
//select in sc_users table where ID_USER is $key;
}
So the goal is to select all ID_USER in sc_users_teaching table, then find ID_USER in sc_users and sort them by lastconnexion
I cannot figure how to make the request (UNION or JOIN ?) so if you could help me, I will appreciate.
Thank you !
Solution: "SELECT * FROM sc_users WHERE ID_USER IN (SELECT ID_USER FROM sc_users_teaching WHERE lesson = '_ADOBE_PHOTOSHOP_' ) ORDER BY lastconnexion ASC"
Thanks u_mulder