You are here

function fb_friend_query_records in Drupal for Facebook 6.3

Same name and namespace in other branches
  1. 7.3 contrib/fb_friend.module \fb_friend_query_records()

File

contrib/fb_friend.module, line 548
This module implements several features specific to Facebook friend networks.

Code

function fb_friend_query_records($args) {
  $types = array(
    'fbu_actor' => '%d',
    'fbu_target' => '%d',
    'ref_id' => '%d',
    'module' => "'%s'",
    'label' => "'%s'",
  );
  $where = array();
  $a = array();
  foreach ($args as $key => $value) {
    if ($type = $types[$key]) {
      $where[] = "{$key}={$type}";
      $a[] = $value;
    }
  }
  $result = db_query("SELECT * FROM {fb_friend} WHERE " . implode(' AND ', $where), $a);
  $items = array();
  while ($row = db_fetch_array($result)) {
    $items[$row['fb_friend_id']] = $row;
  }
  return $items;
}