向用户显示他们的 FQL 选择结果
我将提示用户通过三种方式过滤他们的朋友列表:
- 仅选择男性朋友
- 选择仅女性朋友
- 选择所有朋友
例如,过滤器1将是:
SELECT name, sex, pic_big, uid FROM user WHERE uid in (SELECT uid2 FROM friend WHERE uid1 = me()) AND sex = "male"
现在我需要向用户显示此信息!如何显示结果(过滤后)好友的网格或列表?
I will prompt users to filter their friend list in 3 ways:
- select only male friends
- select only female friends
- select all friends
for example, filter 1 will be:
SELECT name, sex, pic_big, uid FROM user WHERE uid in (SELECT uid2 FROM friend WHERE uid1 = me()) AND sex = "male"
now I need to display this information to the user! How can I show a grid or list of the resulting (filtered) friends?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的...首先,您需要:
现在,回答您的问题。
Graph API Explorer 是一个很好的入门方式,可以浏览 API 以了解您的情况可以获得结果。您甚至可以使用 Graph API 运行 FQL 查询。
这里需要注意的一件事是,因为您正在处理用户的性别并且未在 API 中建立索引(这意味着它不能成为搜索条件),所以您必须首先检索用户的朋友,然后才能检索拨打电话检索每个用户的性别。
With regard to displaying the information. One could use a simple method of iterating through an array of data (possibly populated by a previous call to the API) and printing out the data wrapped in
html
tags.这是一个简单的例子,迭代一个数组并在 html 中打印该数组的内容。
Ok... First of all you'll need :
Now, to your question.
The Graph API Explorer is a great way to get started and poke around at the API to see how you can get results. You can even run FQL queries with the Graph API.
One thing to note here is that because you are dealing with the users gender and that is not indexed in the API (that means that it can not be a search criteria), you'll have to first retrieve the users friends and only after that make calls to retrieve each of the users gender.
With regard to displaying the information. One could use a simple method of iterating through an array of data (possibly populated by a previous call to the API) and printing out the data wrapped in
html
tags.Here is a simple example or iterating through an array and printing the contents of that array in html.