Answer the question
In order to leave comments, you need to log in
Loop two queries?
There are two queries:
$z1 = $mysqli->query("SELECT iduser, hisuser FROM his WHERE iduser = '{defined id}'");
$z2 = $mysqli->query("SELECT id, text FROM rew WHERE id = hisuser(from top query)'");
doing so
$z1 = $mysqli->query("SELECT iduser, hisuser FROM his WHERE iduser = '{определенный id}'");
while($qwe= $z1->fetch_object()) {
$f1 = $qwe->iduser;
$f2 = $qwe->hisuser;
echo "$f1 - $f2";
}
Answer the question
In order to leave comments, you need to log in
All this can be done within a single request, or rather, you need to do it within a single request.
SELECT `h`.`iduser`, `h`.`hisuser`, `r`.`id`, `r`.`text`
FROM `his` AS `h`
INNER JOIN `rew` AS `r` ON `r`.`id` = `h`.`hisuser`
WHERE `h`.`iduser` = {определенный id}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question