本文整理汇总了PHP中db_fetch_object函数的典型用法代码示例。如果您正苦于以下问题:PHP db_fetch_object函数的具体用法?PHP db_fetch_object怎么用?PHP db_fetch_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_fetch_object函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: computeSample
public function computeSample()
{
// Initialize the projects array.
$this->projectIssueMetricInitProjects(array('new_issues' => 0, 'new_comments' => 0, 'new_total' => 0));
// Load options.
$sample = $this->currentSample;
$where_pieces = array();
$args = array();
$args = array_merge($args, array($sample->sample_startstamp, $sample->sample_endstamp));
// Restrict to only the passed projects.
if (!empty($sample->options['object_ids'])) {
$where_pieces[] = "pi.pid IN (" . db_placeholders($sample->options['object_ids']) . ")";
$args = array_merge($args, $sample->options['object_ids']);
}
if (empty($where_pieces)) {
$where = '';
} else {
$where = ' AND ' . implode(' AND ', $where_pieces);
}
// Pull the count of new issues per project.
$projects = db_query("SELECT pi.pid, COUNT(pi.nid) AS count FROM {project_issues} pi INNER JOIN {node} n ON pi.nid = n.nid WHERE n.created >= %d AND n.created < %d{$where} GROUP BY pi.pid", $args);
while ($project = db_fetch_object($projects)) {
$this->currentSample->values[$project->pid]['new_issues'] = (int) $project->count;
$this->currentSample->values[$project->pid]['new_total'] = (int) $project->count;
}
// Pull the count of new issue comments per project.
$projects = db_query("SELECT pi.pid, COUNT(pi.cid) AS count FROM {project_issue_comments} pi WHERE pi.timestamp >= %d AND pi.timestamp < %d{$where} GROUP BY pi.pid", $args);
while ($project = db_fetch_object($projects)) {
$this->currentSample->values[$project->pid]['new_comments'] = (int) $project->count;
// Add the comment count to the total.
$this->currentSample->values[$project->pid]['new_total'] = $this->currentSample->values[$project->pid]['new_total'] + (int) $project->count;
}
}
示例2: getUserIDFromName
static function getUserIDFromName($user_name)
{
$results = db_query("SELECT uid FROM {users} WHERE name='%s'", $user_name);
$result = db_fetch_object($results);
$user_id = $result->uid;
return $user_id;
}
示例3: tokenLogin
private function tokenLogin()
{
global $user;
if (empty($this->auth_token)) {
return false;
}
$max_date = time() - 12 * 3600;
// 12 hours since created
db_query("DELETE FROM {guifi_api_tokens} WHERE created < FROM_UNIXTIME(%d)", $max_date);
$dbtoken = db_fetch_object(db_query("SELECT * FROM {guifi_api_tokens} WHERE token = '%s'", $this->auth_token));
if (!$dbtoken->uid) {
return false;
}
$token = base64_decode($this->auth_token);
$token = explode(':', $token);
if (count($token) < 3) {
return false;
}
$uid = $token[0];
$hash = $token[1];
$time = $token[2];
if ($dbtoken->uid != $uid) {
return false;
}
$account = user_load($uid);
$check = md5($account->mail . $account->pass . $account->created . $account->uid . $time . $dbtoken->rand_key);
if ($check == $hash) {
$user = $account;
return true;
}
return false;
}
示例4: apiary_project_help_text_form
function apiary_project_help_text_form()
{
$categories = db_query("select DISTINCT category from {apiary_project_help_text} ");
$records = db_query("select * from {apiary_project_help_text} ");
$form = '';
$k = 0;
$flag = true;
while ($category = db_fetch_object($categories)) {
$form[$category->category] = array('#type' => 'fieldset', '#title' => t($category->category), '#weight' => $k, '#collapsible' => TRUE, '#collapsed' => TRUE);
$k++;
if ($category->category == 'General') {
$flag = false;
}
}
if ($flag) {
$form['General'] = array('#type' => 'fieldset', '#title' => t('General'), '#weight' => $k, '#collapsible' => TRUE, '#collapsed' => TRUE);
}
while ($record = db_fetch_object($records)) {
$form[$record->category][$record->term] = array('#type' => 'textarea', '#cols' => '30', '#rows' => '2', '#title' => t($record->label), '#default_value' => t($record->help_text));
}
$form['General']['new_term'] = array('#type' => 'textfield', '#title' => t('Term Name'));
$form['General']['new_label'] = array('#type' => 'textfield', '#title' => t('Term Label'));
$form['General']['new_category'] = array('#type' => 'select', '#title' => t('Category'), '#options' => array('General' => t('General')));
$form['General']['new_help_text'] = array('#type' => 'textarea', '#cols' => '30', '#rows' => '2', '#title' => t('Help text'));
$form['submit'] = array('#type' => 'submit', '#value' => t('Save'), '#weight' => 200);
return $form;
}
示例5: run
/**
* Performs the fetch of the work request
*
* @param $params
* Associative array of parameters
* - $params->wr: Work Request ID or array of
* - $params->user: User ID making the request
* @return
* - The request object on success
* - Error message if access is denied, or wr was not filled.
*/
function run($params)
{
$access = access::getInstance();
if ($params['GET']['wr'] == null) {
error_logging('WARNING', "No work request number (wr) provided.");
return new error('No work request number (wr) provided.');
}
if (!preg_match('/^(\\d+)(,\\d+)*$/', $params['GET']['wr'])) {
error_logging('WARNING', 'Provided work request (wr) of; "' . $params['GET']['wr'] . '" argument does not match required format.');
return new error('Bad work request (wr) argument. Argument must be in the format of one or more integers seperated by commas.');
}
$response = new response('Success');
$sql = 'SELECT * FROM request WHERE request_id IN (' . $params['GET']['wr'] . ')';
$result = db_query($sql);
while ($row = db_fetch_object($result)) {
if ($access->permitted('wr/view', $row->request_id)) {
$object = new WrmsWorkRequest();
$object->populate($row);
$object->populateChildren();
$response->data[] = $object;
} else {
$response->data[] = new error('You cannot access this work request.', 403);
# EKM TODO add id not allowed option
}
}
return $response;
}
示例6: get
function get($key)
{
global $user;
// Load local cache for multiple hits per page.
if (isset($this->content[$key])) {
return $this->content[$key];
}
// Handle garbage collection
$this->gc();
$cache = db_fetch_object(db_query("SELECT data, created, headers, expire, serialized FROM {" . $this->name . "} WHERE cid = '%s'", $key));
if (isset($cache->data)) {
// If the data is permanent or we're not enforcing a minimum cache lifetime
// always return the cached data.
if ($cache->expire == CACHE_PERMANENT || !variable_get('cache_lifetime', 0)) {
$cache->data = db_decode_blob($cache->data);
if ($cache->serialized) {
$cache->data = unserialize($cache->data);
}
} else {
if ($user->cache > $cache->created) {
// This cache data is too old and thus not valid for us, ignore it.
return 0;
} else {
$cache->data = db_decode_blob($cache->data);
if ($cache->serialized) {
$cache->data = unserialize($cache->data);
}
}
}
$this->content[$key] = $cache;
return $cache;
}
return 0;
}
示例7: sql_getProgrammData
function sql_getProgrammData($id)
{
/* returns Data from Programm Table for ID */
global $CFG;
$qid = db_query("\n SELECT \n ProgrammPRGID as id, \n ProgrammName as name, \n ProgrammVersion as version\n FROM {$CFG->tbl_programm} \n WHERE ProgrammPRGID={$id} ORDER BY ProgrammSort\n ");
return db_fetch_object($qid);
}
示例8: cvs_to_versioncontrol_project_update_2
/**
* Convert project repository data.
*/
function cvs_to_versioncontrol_project_update_2()
{
// This determines how many projects will be processed in each batch run. A reasonable
// default has been chosen, but you may want to tweak depending on your setup.
$limit = 100;
// Multi-part update
if (!isset($_SESSION['cvs_to_versioncontrol_project_update_2'])) {
$_SESSION['cvs_to_versioncontrol_project_update_2'] = 0;
$_SESSION['cvs_to_versioncontrol_project_update_2_max'] = db_result(db_query("SELECT COUNT(*) FROM {cvs_projects}"));
}
// Pull the next batch of users.
$projects = db_query_range("SELECT p.nid, p.rid, p.directory, r.modules FROM {cvs_projects} p INNER JOIN {cvs_repositories} r ON p.rid = r.rid ORDER BY p.nid", $_SESSION['cvs_to_versioncontrol_project_update_2'], $limit);
// Loop through each project.
while ($project = db_fetch_object($projects)) {
// Add the repo module, and chop off the trailing slash.
$directory = '/' . trim($project->modules) . drupal_substr($project->directory, 0, drupal_strlen($project->directory) - 1);
db_query("INSERT INTO {versioncontrol_project_projects} (nid, repo_id, directory) VALUES (%d, %d, '%s')", $project->nid, $project->rid, $directory);
$_SESSION['cvs_to_versioncontrol_project_update_2']++;
}
if ($_SESSION['cvs_to_versioncontrol_project_update_2'] >= $_SESSION['cvs_to_versioncontrol_project_update_2_max']) {
$count = $_SESSION['cvs_to_versioncontrol_project_update_2_max'];
unset($_SESSION['cvs_to_versioncontrol_project_update_2']);
unset($_SESSION['cvs_to_versioncontrol_project_update_2_max']);
return array(array('success' => TRUE, 'query' => t('Converted @count project repository entries.', array('@count' => $count))));
}
return array('#finished' => $_SESSION['cvs_to_versioncontrol_project_update_2'] / $_SESSION['cvs_to_versioncontrol_project_update_2_max']);
}
示例9: buildTypeMap
function buildTypeMap()
{
$result = db_query("SELECT * FROM {biblio_contributor_type} ;");
while ($type = db_fetch_object($result)) {
$this->typeMap[$type->type] = $type->ctid;
}
}
示例10: performCheck
public function performCheck(&$obj, &$user)
{
//Check if user has been assigned to the system
$return = false;
$systems = $user->getSystems();
$system_id = 0;
if (is_numeric($obj)) {
//Was passed request ID
$result = db_query("SELECT system_id FROM request WHERE request_id = %d", $obj);
if ($result) {
$info = db_fetch_object($result);
$system_id = $info->system_id;
}
}
if (isset($systems[$system_id])) {
//If the system info exists user must have access to view it
switch ($systems[$system_id]['role']) {
case 'S':
case 'C':
case 'E':
$return = true;
break;
}
}
return $return;
}
示例11: user_admin_online_liste
function user_admin_online_liste()
{
$OnListe = '';
$class = '';
$dif = date('Y-m-d H:i:s', time() - USERUPTIME);
$erg = db_query("SELECT DISTINCT `uid`, DATE_FORMAT(`uptime`, '%d.%m.%Y - %H:%i:%s') as `datum`, `ipa`, `name`, `content` as aufenthalt FROM `prefix_online` LEFT JOIN `prefix_user` on `prefix_user`.`id` = `prefix_online`.`uid` WHERE `uptime` > '" . $dif . "' ORDER BY `uid` DESC");
while ($row = db_fetch_object($erg)) {
$name = $row->name;
if ($row->uid == 0) {
$name = 'Gast';
}
$host_patterns = array('/crawl-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}\\.googlebot\\.com/si', '/[a-z]*[0-9]*\\.inktomisearch\\.com/si', '/[a-z]*[0-9]*\\.ask\\.com/si', '/p[0-9A-F]*\\.dip[0-9]*\\.t-(dialin|ipconnect)\\.(net|de)/si', '/[0-9A-F]*\\.ipt\\.aol\\.com/si', '/dslb-[0-9]{3}-[0-9]{3}-[0-9]{3}-[0-9]{3}.pools.arcor-ip.net/si', '/crawl[0-9]*\\}exabot\\.com/si', '/[0-9A-Z]+\\.adsl\\.highway\\.telekom\\.at/si');
$host_names = array('Bot Google', 'Bot Inktomi/Yahoo', 'Bot Ask.com', 'T-Online', 'AOL', 'Arcor DSL', 'Bot Exalead', 'Telekom Austria DSL');
$class = $class == 'Cmite' ? 'Cnorm' : 'Cmite';
$OnListe .= '<tr class="' . $class . '">';
$OnListe .= '<td>' . $name . '</td>';
$OnListe .= '<td>' . $row->datum . '</td>';
$OnListe .= '<td>' . $row->ipa . '</td>';
$OnListe .= '<td>' . preg_replace($host_patterns, $host_names, @gethostbyaddr($row->ipa)) . '</td>';
$OnListe .= '<td>' . $row->aufenthalt . '</td>';
$OnListe .= '</tr>';
}
// $OnListe = substr($OnListe,0,strlen($OnListe) - 3);
return $OnListe;
}
示例12: getLayersInfoArray
static function getLayersInfoArray($query, $query_args=null) {
$arr_theme=array();
$j=0;
$layersChecked=$GLOBALS['layersChecked'];
if ($query_args == null) {
$result_layer=db_query($query);
}
else {
$result_layer=db_query($query, $query_args);
}
if (!$result_layer) {
$errmsgstr=$GLOBALS['errmsgstr'];
die('Error fetching layer info. ' . $errmsgstr);
}
else {
while ($layer_obj=db_fetch_object($result_layer)) {
$layer_tablename=$layer_obj->layer_tablename;
$layer_name=$layer_obj->layer_name;
$participation_type=$layer_obj->participation_type;
$p_nid=$layer_obj->p_nid;
$access=$layer_obj->access;
$layer_type=$layer_obj->layer_type;
$arr_theme[$j]["id"]="li" . $layer_tablename;
$arr_theme[$j]["text"]=treeViewEntryHTML($layer_tablename, $layer_name, $participation_type, $layer_type, $p_nid, $access);
$arr_theme[$j]["title"]=$layer_name;
$j++;
}
}
return $arr_theme;
}
示例13: loadPublicationTypes
/**
* loadPublicationTypes - get number values for word values of publication types
*/
function loadPublicationTypes()
{
static $biblioTypes = array();
if ($biblioTypes) {
// done
} else {
$sql = 'SELECT * FROM {biblio_types}';
$res = db_query($sql);
if ($res) {
while ($data = db_fetch_object($res)) {
$key = $data->tid;
$name = $data->name;
$biblioTypes[strtolower($name)] = $key;
}
// add a couple items that are not in the given set
$biblioTypes['series'] = $biblioTypes['journal'];
$biblioTypes['article'] = $biblioTypes['journal article'];
} else {
// failed, so fall back on bad hard coding
// these should match what is in table: biblio_types
// and match what biblio_install, _add_publication_types() sets up
$biblioTypes['book'] = 100;
$biblioTypes['journal article'] = 102;
$biblioTypes['series'] = $biblioTypes['journal'];
$biblioTypes['article'] = $biblioTypes['journal article'];
$biblioTypes['journal'] = 131;
$biblioTypes['original description'] = 132;
$biblioTypes['treatment'] = 133;
}
}
return $biblioTypes;
}
示例14: getSchema
function getSchema($layer_tablename){
//get column names except custom columns
global $table_cols;
global $col_type;
$query = "select column_name,data_type from information_schema.columns where table_name='%s' AND column_name not like '".AUTO_DBCOL_PREFIX."%'";
$result = db_query($query,$layer_tablename);
if(!$result) {
} else {
while($obj = db_fetch_object($result)) {
$cols .= "'".$obj->column_name."',";
$col_type[$obj->column_name] = $obj->data_type;
}
}
$cols = substr($cols,0,(strlen($cols)-1));
$col_info = getDBColDesc($layer_tablename,$cols);
//get layer_type
$query = "select layer_type from \"Meta_Layer\" where layer_tablename = '%s'";
$result = db_query($query,$layer_tablename);
if(!$result) {
} else {
while($obj = db_fetch_object($result)) {
$layer_type = $obj->layer_type;
}
}
if(isset($_REQUEST['action'])){
$table_cols = $col_info;
} else {
$table_cols = $cols;
}
return $layer_type;
}
示例15: page_by_title
function page_by_title($title, $edit = false)
{
$ret = db_fetch_object(db_query("SELECT * FROM pages WHERE short='%s' LIMIT 1", $title));
if ($edit && admin()) {
$ret->content = p_quickedit_html($ret->id) . $ret->content;
}
return $ret->content;
}