Each user have a list of friends from Facebook. I need to check if any of them is already a member of our site.
I get a list of FB friends in array. Is there any better way than doing the following?
foreach($friends as $key => $value){
$results=mysql_query("SELECT * FROM `users` WHERE userId='$value'") or die (mysql_error());
}
or another way:
$where="userId='435345434'";
foreach($friends as $key => $value){
$where=$where." or userId='".$value."'";
}
$results=mysql_query("SELECT * FROM `users` WHERE $where") or die (mysql_error());
I hope anybody can help with this.
tnx!