我正在尝试编写基本上可以在我的网站上找到您的 facebook 朋友的代码。我在 phpmyadmin 中成功运行了查询,但是由于某种原因,当我尝试从 php 运行代码时它不起作用
这是php代码。每当我使用 $string echo 并将其放在 mysql 中时,它都可以正常工作,但是无论出于何种原因,在 php 中运行它时,查询都不会返回任何结果。
$fql = "SELECT uid FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = 100000903067831) AND is_app_user = 'true'";
$param = array(
'method' => 'fql.query',
'query' => $fql
);
$this->load->library('facebook');
echo $this->facebook->getLoginUrl();
$fqlResult = $this->facebook->api($param);
$userIDarray = array();
foreach($fqlResult as $result)
{
echo $result['uid']."<br>";
array_push($userIDarray, intval($result['uid']));
}
$string = implode(', ',$userIDarray);
echo $string;
$vars = array($string);
$query = $this->db->query("SELECT * FROM users WHERE users.facebook_id IN (?)", $vars);
echo var_dump($query);
foreach($query->result() as $data)
{
echo var_dump($data);
}