You are here

function feedback_load in Feedback 5.2

Same name and namespace in other branches
  1. 6.2 feedback.module \feedback_load()
  2. 7.2 feedback.module \feedback_load()

Load feedback entries from the database.

Parameters

$array: A keyed array of optional where clause conditions.

1 call to feedback_load()
feedback_form in ./feedback.module
Form builder function for a user feedback form.

File

./feedback.module, line 168
Allows site visitors and users to report issues about this site.

Code

function feedback_load($array) {
  $where = $args = array();
  if (!empty($array)) {
    foreach ($array as $column => $value) {
      $where[] = 'f.' . $column . ' = ' . (is_numeric($value) ? '%d' : "'%s'");
      $args[] = $value;
    }
  }
  $sql = "SELECT f.*, u.name FROM {feedback} f INNER JOIN {users} u ON f.uid = u.uid";
  if (!empty($where)) {
    $sql .= ' WHERE ' . implode(' AND ', $where);
  }
  $result = db_query($sql, $args);
  $entries = array();
  while ($entry = db_fetch_object($result)) {
    $entries[$entry->fid] = $entry;
  }
  return $entries;
}