开发者

Facebook: What's wrong with this FQL statement?

开发者 https://www.devze.com 2023-02-09 09:44 出处:网络
I\'m trying to get some data about myself (logged in) through the facebook.php API. This works: SELECT name FROM user WHERE sex=\'female\' AND uid IN ( SELECT uid2 FROM friend WHERE uid1= me() )

I'm trying to get some data about myself (logged in) through the facebook.php API.

This works:

SELECT name FROM user WHERE sex='female' AND uid IN ( SELECT uid2 FROM friend WHERE uid1= me() )

This doesn't work: [gives "Exception: 1: An unknown error occurred"]

SELECT eid, name, location, start_time, pic_big, host, description FROM event WHERE eid IN ( SELECT eid FROM event_member WHERE uid = me() )

I have the follow开发者_如何学Going permissions setup:

Facebook: What's wrong with this FQL statement?


Your query is working just fine for me, most likely it's a permission issue. You see the small "See more" link under Access my Profile information?

Click it, if you can't see Events in the list then you need the user_events permission.

EDIT:
Please go to fql.query, in the Test Console paste the query and choose the application that causing the problem...if you got the expected result, then it's something to do with your code (the way you are calling the query, whether it's a PHP or other language).

If you are still facing the problem, try granting the create_event permission just to test.


I don't know the facebook api but I'd start by removing all superfluous stuff

does this work ?

SELECT `eid` FROM `event` 
WHERE `eid` IN 
( SELECT `eid` FROM `event_member` WHERE `uid` = me() )

or even just

SELECT `eid` FROM `event_member` WHERE `uid` = me()

if it does add more stuff to it and don't forget the backticks.

To find out the correct fields you could use...

explain  `event` 

This gives a list of fields and types assuming facebook uses mySQL

DC

Hmm ignore the comments about backticks and explain they arent used in FQL so just try simplifying the query until the error occurs then you know what's triggering it.

DC

0

精彩评论

暂无评论...
验证码 换一张
取 消