比较friendslist Facebook的数组MySQL表 [英] Compare Facebook array of friendslist to MySQL table

查看:107
本文介绍了比较friendslist Facebook的数组MySQL表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我检索使用图形API的朋友一个数组,对一个MySQL表的用户列表。我(在某种程度上)知道如何使用加入,但我不知道你将如何去在PHP比较数组一个MySQL表。基本上,Facebook的ID是什么,我期待相匹配,然后绘制所有数据从该行是否匹配。

谢谢,
迈克尔·阿米奇


解决方案

  $ SQL =的mysql_query(SELECT * FROM用户WHERE fb_id IN(12345,1234,123,12346)) ;而($行= mysql_fetch_array($ SQL)){
  回声$行[用户名];
}

注意:请确保你持有Facebook的IDS列添加一个索引

I retrieve an array of friends using the graph api, and have a list of users on a MySQL table. I (sort of) know how to use join, but I don't know how you would go about comparing an array in php to a mysql table. Basically the Facebook ID is what I am looking to match, and then drawing all of the data from the row if it matches.

Thanks, Michael Amici

解决方案

$sql = mysql_query("SELECT * FROM users WHERE fb_id IN (12345,1234,123,12346)");

while($row = mysql_fetch_array($sql)){
  echo $row['username'];
}

Note: Make sure you add an index on the column that holds the facebook ids.

这篇关于比较friendslist Facebook的数组MySQL表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆