function getOneField($field, $table = "", $where = "", $value = "") { $params = array(); if ($value != "null") { $params[":value"] = $value; } if ($table != "") { $sql = "SELECT " . $field . " Field FROM " . $table . " "; if ($where != '') { $sql .= " WHERE " . $where . " = :value"; } } else { $sql = $field; } $return = getFirstResultFromQuery($sql); return isset($return->Field) ? $return->Field : null; }
public function getUserInfoFromUsername($username) { $sql = "select su.user_id, su.username, c.first_name, c.last_name\n from security_user su\n inner join contact c on c.contact_id = su.contact_id\n where su.active_ind = 1 and su.username = ?"; $param = array($username); return getFirstResultFromQuery($sql, $param); }