I want to only fetch data which is related to foreach value.but em getting empty result.$userid is an array, thats why i need to use for each .Please correctify this or suggest any alternative approach.
$user_id=$_POST['uid'];
foreach($user_id as $user_idf){
$sql=mysqli_query($db3->connection,"select * from profile where uid='$user_idf'");
while($row=mysqli_fetch_array($sql)){
$num=$row['country'];
echo $num;
}
}
The one query to base is prefered. Also you’ve forgotten field
countryin you query. Try this way: