I cannot get all user id with 1st query to use these ids to 2nd query.
When I count 1st query its show 1 always. That means it get only one result from sql. But I want, Use my 1st query's all id to 2nd query.
Please where is my wrong here?
My code:
$a = $session->username;
$b = $session->pname;
if (empty($b)) $b = $a;
$g = mysqli_query($dbh,"SELECT id FROM update WHERE `from_id`='$b' OR `to_id`='".$session->bdid."'") or die(mysqli_error($dbh));
while ($row = mysqli_fetch_assoc($g)) {
$id = $row['id'];
date_default_timezone_set('Asia/Dhaka');
$timestamp = date("M j, y; g:i a", time() - 2592000);
$count = mysqli_num_rows($g);
$u = mysqli_query($dbh,"SELECT * FROM update WHERE `id`='".$id."' AND `view` = '0' AND `created` > '".$timestamp."' ORDER BY created DESC") or die(mysqli_error($dbh));
$count1 = mysqli_num_rows($u);
$count2 = ($count - $count1);
echo ''.$count2.'';
}