0

hello i'm trying to do a loop to all of our users account and see if they have already a partner or pair but the problem is after 2 user, the loop just stops and won't loop to all user accounts that's available. Please don't leave me hanging or leaving comments with no solution just like stack overflow.
<?php
$sqlo = mysqli_query($conn, "SELECT `username` FROM users");
$i=1;
$counter = array();
while ($h=mysqli_fetch_assoc($sqlo)) {
$counter[$i] = $h['username'];
$i++;
}

for($i = 1; $i <= Fixed_count($counter); $i++){

$b = $counter[$i];

$query1 = mysqli_query($conn2, "select * from `$b` where username='$newuser'");
$query2 = mysqli_query($conn2, "select * from `$b` where `status`='yes'");

$user1 = array();
$user2 = array();

while($result = mysqli_fetch_array($query1)){

$user1['username'] = $result['username'];
$user1['status'] = $result['status'];
/*more user info*/

while($result2 = mysqli_fetch_array($query2)){

$user2['username'] = $result2['username'];
$user2['status'] = $result2['status'];
/*more user info*/

if($temp_counter < 4){
if($user1['username'] != $user2['username'] && $user1['status'] == "yes" && $user2['status'] == "yes"){
if(/*more condition*/){
/*if condition's are met execute process*/
echo "Success!";
continue 2;
}
}else{
continue 2;
}
}

}
}
}
echo "Loop stopped at user: ".$i;
?>

Comments
Add Comment