当前位置: 首页>>代码示例>>PHP>>正文


PHP db_fetch函数代码示例

本文整理汇总了PHP中db_fetch函数的典型用法代码示例。如果您正苦于以下问题:PHP db_fetch函数的具体用法?PHP db_fetch怎么用?PHP db_fetch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了db_fetch函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: show_branch

function show_branch()
{
    switch (@$_GET['message']) {
        case "branchjustadded":
            $message_html = template_get("message", array('message' => "Город успешно добавлен"));
            break;
        default:
            $message_html = template_get("nomessage");
    }
    $branch_id = $_GET['branch'];
    $branch = db_easy("SELECT * FROM `phpbb_branches` WHERE `id`={$branch_id}");
    $pointsRES = db_query("SELECT * FROM `phpbb_points` WHERE `branch_id`={$branch_id}");
    if (db_count($pointsRES) > 0) {
        while ($point = db_fetch($pointsRES)) {
            $points_html .= "<div style='padding-bottom:5px;'><a href='/manager.php?action=show_point&point={$point['id']}'>{$point['name']}</a></div>";
        }
    } else {
        $points_html = "-";
    }
    if (check_rights('add_branch')) {
        $edit_branch_html = "<a href='/manager.php?action=edit_branch&branch={$branch_id}' style='font-size:8pt;'>Редактировать</a>";
    }
    $html .= template_get("branches/show_branch", array('name' => $branch['name'], 'editbranch' => $edit_branch_html, 'message' => $message_html, 'points' => $points_html));
    return $html;
}
开发者ID:jsib,项目名称:intranet,代码行数:25,代码来源:show_branch.php

示例2: display_trial_balance

function display_trial_balance()
{
    global $table_style, $path_to_root;
    start_table($table_style);
    $tableheader = "<tr>\n        <td rowspan=2 class='tableheader'>" . tr("Account") . "</td>\n        <td rowspan=2 class='tableheader'>" . tr("Account Name") . "</td>\n\t\t<td colspan=2 class='tableheader'>" . tr("Brought Forward") . "</td>\n\t\t<td colspan=2 class='tableheader'>" . tr("This Period") . "</td>\n\t\t<td colspan=2 class='tableheader'>" . tr("Balance") . "</td>\n\t\t</tr><tr>\n\t\t<td class='tableheader'>" . tr("Debit") . "</td>\n        <td class='tableheader'>" . tr("Credit") . "</td>\n\t\t<td class='tableheader'>" . tr("Debit") . "</td>\n\t\t<td class='tableheader'>" . tr("Credit") . "</td>\n        <td class='tableheader'>" . tr("Debit") . "</td>\n        <td class='tableheader'>" . tr("Credit") . "</td>\n        </tr>";
    echo $tableheader;
    $k = 0;
    $accounts = get_gl_accounts();
    while ($account = db_fetch($accounts)) {
        if (is_account_balancesheet($account["account_code"])) {
            $begin = null;
        } else {
            $begin = begin_fiscalyear();
            if ($_POST['TransFromDate'] < $begin) {
                $begin = $_POST['TransFromDate'];
            }
            $begin = add_days($begin, -1);
        }
        $prev_balance = get_balance($account["account_code"], $begin, $_POST['TransFromDate'], false, false);
        $curr_balance = get_balance($account["account_code"], $_POST['TransFromDate'], $_POST['TransToDate']);
        if (check_value("NoZero") && !$prev_balance && !$curr_balance) {
            continue;
        }
        alt_table_row_color($k);
        $url = "<a href='{$path_to_root}/gl/inquiry/gl_account_inquiry.php?" . SID . "TransFromDate=" . $_POST["TransFromDate"] . "&TransToDate=" . $_POST["TransToDate"] . "&account=" . $account["account_code"] . "'>" . $account["account_code"] . "</a>";
        label_cell($url);
        label_cell($account["account_name"]);
        display_debit_or_credit_cells($prev_balance);
        display_debit_or_credit_cells($curr_balance);
        display_debit_or_credit_cells($prev_balance + $curr_balance);
        end_row();
    }
    end_table(1);
}
开发者ID:ravenii,项目名称:guardocs,代码行数:34,代码来源:gl_trial_balance.php

示例3: getQueue

 function getQueue($type = false)
 {
     if (!$type) {
         $type = $this->name;
     }
     loader_import('cms.Workspace.Notice.' . $this->types[$type]);
     $res = db_fetch('select * from sitellite_msg_queue where type = ?', $type);
     if (!$res) {
         $this->error = db_error();
         return false;
     } elseif (is_object($res)) {
         $res = array($res);
     }
     foreach ($res as $k => $v) {
         $qid = $res[$k]->id;
         $struct = $res[$k]->struct;
         $res[$k] = unserialize($struct);
         if (!$res[$k]) {
             $this->error = 'unserialize() failed: ' . $struct;
             return false;
         }
         $res[$k]->qid = $qid;
     }
     return $res;
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:25,代码来源:Notice.php

示例4: EntryAddForm

 function EntryAddForm()
 {
     parent::MailForm();
     $this->parseSettings('inc/app/timetracker/forms/entry/add/settings.php');
     $res = db_fetch('select username, firstname, lastname from sitellite_user order by lastname asc');
     if (!$res) {
         $res = array();
     } elseif (is_object($res)) {
         $res = array($res);
     }
     $users = array();
     foreach ($res as $row) {
         if (!empty($row->lastname)) {
             $users[$row->username] = $row->lastname;
             if (!empty($row->firstname)) {
                 $users[$row->username] .= ', ' . $row->firstname;
             }
             $users[$row->username] .= ' (' . $row->username . ')';
         } else {
             $users[$row->username] = $row->username;
         }
     }
     $this->widgets['users']->setValues($users);
     $this->widgets['users']->setDefault(session_username());
     $this->widgets['users']->addRule('not empty', 'You must select at least one user.');
     $this->widgets['started']->setDefault(date('Y-m-d H:i:s'));
     $this->widgets['ended']->setDefault(date('Y-m-d H:i:s'));
     global $cgi;
     $this->widgets['proj_name']->setValue(db_shift('select name from timetracker_project where id = ?', $cgi->project));
     $this->widgets['submit_button']->buttons[1]->extra = 'onclick="history.go (-1); return false"';
 }
开发者ID:vojtajina,项目名称:sitellite,代码行数:31,代码来源:index.php

示例5: search_facets_extras_values_by_name

function search_facets_extras_values_by_name($name, $viewer_id = 0, $more = array())
{
    $enc_name = AddSlashes($name);
    $sql = "SELECT e.value, COUNT(d.dot_id) AS count_dots, COUNT(DISTINCT(d.sheet_id)) AS count_sheets";
    $sql .= " FROM DotsSearch d, DotsSearchExtras e WHERE 1";
    $sql .= " AND d.dot_id=e.dot_id";
    $sql .= " AND e.name='{$enc_name}'";
    if ($more['user_id']) {
        $enc_user = AddSlashes($more['user_id']);
        $sql .= " AND d.user_id='{$enc_user}'";
    }
    # See those perms? That makes caching hard unless
    # we only facet on public things...
    if ($perms = _search_facets_perms($viewer_id, $more)) {
        $sql .= " AND {$perms}";
    }
    $sql .= " GROUP BY e.value";
    $rsp = db_fetch($sql, $more);
    # We sort in memory because ORDER-ing by 'count_sheets' in MySQL
    # will always cause a filesort (because we're already grouping on
    # another column)
    function cmp($a, $b)
    {
        if ($a['count_sheets'] == $b['count_sheets']) {
            return 0;
        }
        return $a['count_sheets'] > $b['count_sheets'] ? -1 : 1;
    }
    usort($rsp['rows'], 'cmp');
    #
    _search_facets_paginate($rsp, $more);
    return $rsp;
}
开发者ID:netcon-source,项目名称:dotspotting,代码行数:33,代码来源:lib_search_facets.php

示例6: get_comment

function get_comment()
{
    /*Получаем данные от пользователя*/
    if (isset($_POST['id'])) {
        if (!preg_match("/^comment\\-[0-9]{1,2}\\-[0-9]{4}\\-[0-9]{1,2}\\-[0-9]{1,2}\$/", $_POST['id'])) {
            return "Ошибка в формате входных данных (td).";
        } else {
            $id = $_POST['id'];
        }
    } else {
        return "Не определены входные данные (id)";
    }
    /*Обрабатываем полученные данные*/
    $temp = explode('-', $id);
    $year = (int) $temp[2];
    $month = (int) $temp[3];
    $day = (int) $temp[4];
    //Запрос к базе
    $q = db_query("SELECT * FROM `phpbb_timetable_comments` WHERE `year`={$year} AND `month`={$month} AND `day`={$day}");
    if (db_count($q) == 0) {
        return 1;
    } else {
        $result = db_fetch($q);
        return $result['comment1'] . "\n" . $result['comment2'] . "\n" . $result['comment3'];
    }
}
开发者ID:jsib,项目名称:intranet,代码行数:26,代码来源:get_comment.php

示例7: page_index

function page_index()
{
    $q = db_query("SELECT * FROM `intr_message`");
    $message_html = "";
    if (get_user_group() == "writer") {
        $add_message_html = "<a href='" . uri_make_v1(array("UriScript" => "intranet.php", "add_message" => "yes")) . "' style='padding:0 0 0 10px;'><img src='/_content/img/add-icon.png'/></a>";
    } else {
        $add_message_html = "";
    }
    while ($message = db_fetch($q)) {
        $message_html .= "<a href='" . uri_make_v1(array("UriScript" => "intranet.php", "page" => "message", "message" => $message['id'])) . "'>" . trim($message['title']) . "</a>";
        if (check_group("writer") || $user['name'] == get_user()) {
            //$message_html.="<br/><a href='".uri_make_v1(array("UriScript"=>'intranet.php', 'edit_message'=>'yes', 'message'=>$message['id']))."' style='font-size:8pt;'>Редактировать</a>";
            //$message_html.="<a href='".uri_make_v1(array("UriScript"=>'intranet.php', 'delete_message'=>'yes', 'message'=>$message['id']))."' style='padding-left:10px;font-size:8pt;' onClick=\"if(!confirm('Удалить?')) return false;\">Удалить</a>";
            //$message_html.="<br/><br/>";
            /*$comments_html.="<a href='".uri_make_v1(array("UriScript"=>'intranet.php', 'page'=>'message', 'message'=>$message['id'], 'edit_comment'=>'yes', 'comment'=>$comment['id']))."' style='font-size:8pt;'>Редактировать</a>";
            		$comments_html.="<a href='".uri_make_v1(array("UriScript"=>'intranet.php', 'page'=>'message', 'message'=>$message['id'], 'delete_comment'=>'yes', 'comment'=>$comment['id']))."' style='padding-left:10px;font-size:8pt;' onClick=\"if(!confirm('Удалить?')) return false;\">Удалить</a>";
            		*/
            $message_html .= "<a href='" . uri_make_v1(array("UriScript" => "intranet.php", "edit_message" => "yes", "message" => $message['id'])) . "' style='padding:0 0 0 10px;'><img src='/_content/img/edit-icon.png'/></a>";
            $message_html .= "<a href='" . uri_make_v1(array("UriScript" => "intranet.php", "delete_message" => "yes", "message" => $message['id'])) . "' style='padding:0 0 0 10px;' onClick=\"if(!confirm('Удалить?')) return false;\"><img src='/_content/img/remove-icon.png'/></a>" . "<br/>";
        }
    }
    $contacts_html = "";
    $q = db_query("SELECT * FROM `users`");
    while ($user = db_fetch($q)) {
        $contacts_html .= "<a href='" . uri_make_v1(array("UriScript" => "intranet.php", "page" => "contact", "name" => $user['name'])) . "'>" . $user['name_rus'] . "</a>" . "<br/>";
    }
    $html .= template_get('intranet/intranet', array("add_message" => $add_message_html, "message" => $message_html, "contacts" => $contacts_html));
    //Подключаем подвал
    $html .= template_get('footer');
    return $html;
}
开发者ID:jsib,项目名称:dumps.loc,代码行数:32,代码来源:index.php

示例8: sheets_lookup_by_fingerprint

function sheets_lookup_by_fingerprint($fingerprint, $user_id = 0)
{
    $cache_key = "sheets_lookup_fingerprint_{$fingerprint}";
    $cache = cache_get($cache_key);
    if ($cache['ok']) {
        return $cache['data'];
    }
    #
    $enc_fingerprint = AddSlashes($fingerprint);
    $sql = "SELECT * FROM SheetsLookup WHERE fingerprint='{$enc_fingerprint}'";
    if ($user_id) {
        $enc_id = AddSlashes($user_id);
        $sql .= " AND user_id='{$enc_id}'";
    }
    $rsp = db_fetch($sql);
    $sheets = array();
    foreach ($rsp['rows'] as $row) {
        $more = array('sheet_user_id' => $row['user_id']);
        if ($sheet = sheets_get_sheet($row['sheet_id'], $user_id, $more)) {
            $sheets[] = $sheet;
        }
    }
    cache_set($cache_key, $sheets);
    return $sheets;
}
开发者ID:netcon-source,项目名称:dotspotting,代码行数:25,代码来源:lib_sheets_lookup.php

示例9: render

 function render($id, $title)
 {
     global $path_to_root;
     include_once $path_to_root . "/includes/ui.inc";
     $today = date2sql(Today());
     $sql = "SELECT bank_act, bank_account_name, SUM(amount) balance FROM " . TB_PREF . "bank_trans bt" . " INNER JOIN " . TB_PREF . "bank_accounts ba ON bt.bank_act = ba.id" . " WHERE trans_date < '{$today}'" . " AND inactive <> 1";
     if ($this->data_filter != '') {
         $sql .= ' AND ' . $this->data_filter;
     }
     $sql .= " GROUP BY bank_act, bank_account_name" . " ORDER BY bank_account_name";
     $result = db_query($sql);
     br();
     $th = array(_("Account"), _("Balance"));
     start_table(TABLESTYLE, "width=98%");
     table_header($th);
     $k = 0;
     //row colour counter
     while ($myrow = db_fetch($result)) {
         alt_table_row_color($k);
         label_cell($myrow["bank_account_name"]);
         amount_cell($myrow['balance']);
         end_row();
     }
     end_table(1);
 }
开发者ID:raqib,项目名称:ac_dev,代码行数:25,代码来源:bankbalances.php

示例10: player_load_option

function player_load_option(&$user, $option_id = null)
{
    $options = null;
    if (!empty($option_id)) {
        if (is_array($option_id)) {
            foreach ($option_id as $key => $option) {
                if (isset($user['player_options'][$option])) {
                    $options[$option] = $user['player_options'][$option];
                    unset($option_id[$key]);
                }
            }
        } else {
            if (isset($user['player_options'][$option_id])) {
                $options = $user['player_options'][$option_id];
                $option_id = 0;
            }
        }
    }
    if (isset($user['id']) && is_numeric($user['id']) && (!isset($option_id) || !empty($option_id))) {
        !is_array($option_id) or array_walk($option_id, function (&$value) {
            $value = "'{$value}'";
        });
        $query = doquery($q = "SELECT * FROM {{player_options}} WHERE `player_id` = {$user['id']}" . ($option_id ? " AND option_id " . (is_array($option_id) ? 'IN (' . implode(',', $option_id) . ')' : "= '{$option_id}'") : ''));
        while ($row = db_fetch($query)) {
            $user['player_options'][$row['option_id']] = $row['value'];
            $options[$row['option_id']] = $row['value'];
        }
        is_array($option_id) || !$option_id or $options = isset($options[$option_id]) ? $options[$option_id] : null;
    }
    return empty($options) ? null : $options;
}
开发者ID:hayalolsam,项目名称:SuperNova,代码行数:31,代码来源:player_options.php

示例11: list_stat_by_dates

function list_stat_by_dates()
{
    //Определяем переменные
    $stat_html = "";
    $users = array();
    $stats = array();
    $userStats = array();
    //Запрос к базе
    $usersRES = db_query("SELECT  *\r\n\t\t\t\t\t\t\t\tFROM `phpbb_users`\r\n\t\t\t\t\t\t\t\tWHERE (`user_type`=0 OR `user_type`=3) AND `username`!='root' AND `user_email`!='olex3352@gmail.com' AND `user_id`!=95 AND `user_id`!=5871\r\n\t\t\t\t\t\t\t\tORDER BY `username` ASC");
    //Цикл
    while ($userWHILE = db_fetch($usersRES)) {
        $users[$userWHILE['user_id']]['name'] = $userWHILE['username'];
    }
    //Запрос к базе
    $statsRES = db_query("SELECT * FROM `phpbb_stat` ORDER BY `date` DESC");
    //Цикл
    while ($statWHILE = db_fetch($statsRES)) {
        if ($statWHILE['user_id'] != 5871) {
            $date_stats[date("d/m/Y", strtotime($statWHILE['date']))][] = array('uri' => $statWHILE['uri'], 'time' => date("H:i", strtotime($statWHILE['date'])), 'user_id' => $statWHILE['user_id']);
        }
    }
    //Цикл
    foreach ($date_stats as $date => $stat) {
        $stat_html .= "<a href='manager.php?action=show_stat&date={$date}'>" . $date . "</a>: " . count($stat) . "<br/>";
    }
    //Возвращаем значение функции
    return $html .= template_get("stat/list_stat", array('userStats' => $stat_html));
}
开发者ID:jsib,项目名称:intranet,代码行数:28,代码来源:list_stat.php

示例12: OneCatValue

function OneCatValue($table, $value1, $value2, $ident, $param)
{
    $query = "SELECT " . $value1 . "," . $value2 . " FROM " . $table . " WHERE " . $ident . " = " . $param;
    $result = db_query($query);
    $row = db_fetch($result);
    return $row[$value1] . " " . $row[$value2];
}
开发者ID:amcgregor,项目名称:resumewriter,代码行数:7,代码来源:mysql.php

示例13: menu_top

function menu_top($manual_items=""){
	//Подключаем глобальную переменную
	global $DocumentId;
	
	db_connect();
	$html_items="	
					<a href='/engine.php?table=documents'>Документ покупки</a><span class='divider'></span>
					<a href='/engine.php?table=computers'>Сборки компьютеров</a><span class='divider'></span>
					<a href='/statistics.php'>Статистика</a><span class='divider'></span>
					<a href='/engine.php?table=documents&document=$DocumentId&action=list_contragents'>Контрагенты</a><span class='divider'></span>
					<a href='/engine.php?table=documents&document=$DocumentId&action=list_positions'>Позиции</a><span class='divider'></span>
					<br/>
					";
					
    //Запрашиваем из таблицы БД 'menus' все пункты меню, принадлежащие размещению 'top'
    $items_query=db_query("SELECT `href`, `text`, `label` FROM `menu_items` WHERE `area`='top' ORDER BY `order` ASC");

    $number_item=1;
	
	//Ручное добавление пунктов
	$html_items.=$manual_items;
	
    //Пункты меню найдены
    if(db_count($items_query)>0){
        //Перебираем пункты меню
        while($item=db_fetch($items_query)){
            $html_items.="<a href='{$item['href']}' class='".get_class_depend_on_uri("!=", 'table_name', $item['label'])."'>{$item['text']}</a>";
            $html_items.="<span class='divider'></span>";
            if($number_item % 7 == 0) $html_items.="<br/>";
            $number_item++;
        }
    //Такие пункты меню не найдены
    }
    return template_get('menus/menu_top', array('html_items'=>$html_items, 'login'=>$_SESSION['user']));
}
开发者ID:jsib,项目名称:dumps.loc,代码行数:35,代码来源:menus.php

示例14: page_message

function page_message()
{
    $message_id = $_GET['message'];
    $message = db_easy("SELECT * FROM `intr_message` WHERE `id`={$message_id}");
    $q_comm = db_query("SELECT * FROM `intr_comments` WHERE `message_id`={$message_id} ORDER BY `date` DESC");
    $user = db_easy("SELECT * FROM `users` WHERE `id`=" . $message['user_id']);
    $edit_del_comment_html = "";
    if (check_group("writer") || $user['name'] == get_user()) {
        $edit_del_message_html .= "<br/><a href='" . uri_make_v1(array("UriScript" => 'intranet.php', 'page' => 'message', 'message' => $message_id, 'edit_message' => 'yes', 'message' => $message['id'])) . "' style='font-size:8pt;'>Редактировать</a>";
        $edit_del_message_html .= "<a href='" . uri_make_v1(array("UriScript" => 'intranet.php', 'page' => 'message', 'message' => $message_id, 'delete_message' => 'yes', 'message' => $message['id'])) . "' style='padding-left:10px;font-size:8pt;' onClick=\"if(!confirm('Удалить?')) return false;\">Удалить</a>";
    }
    $comments_html = "";
    while ($comment = db_fetch($q_comm)) {
        $user = db_easy("SELECT * FROM `users` WHERE `id`={$comment['user_id']}");
        $comments_html .= "<div style='margin:15px 0 0 0;padding:0 0 0 10px;border-left:2px solid #AAA;'>";
        $comments_html .= "<span style='font-size:8pt;font-style:italic;'><b>" . $user['name_rus'] . ",</b> " . date("d.m.Y H:i", strtotime($comment['date'])) . "</span><br/>" . $comment['text'] . "</div>";
        if (check_group("writer") || $user['name'] == get_user()) {
            $comments_html .= "<a href='" . uri_make_v1(array("UriScript" => 'intranet.php', 'page' => 'message', 'message' => $message_id, 'edit_comment' => 'yes', 'comment' => $comment['id'])) . "' style='font-size:8pt;'>Редактировать</a>";
            $comments_html .= "<a href='" . uri_make_v1(array("UriScript" => 'intranet.php', 'page' => 'message', 'message' => $message_id, 'delete_comment' => 'yes', 'comment' => $comment['id'])) . "' style='padding-left:10px;font-size:8pt;' onClick=\"if(!confirm('Удалить?')) return false;\">Удалить</a>";
        }
    }
    $html .= template_get('message/message', array("user" => $user['name_rus'], "date" => date("d.m.Y", strtotime($message['date'])), "title" => $message['title'], "edit_del_message" => $edit_del_message_html, "text" => $message['text'], "uri_back" => uri_make_v1(array("UriScript" => "intranet.php")), "uri_comment" => uri_make_v1(array("UriScript" => "intranet.php", "page" => "message", "message" => $message_id, "add_comment" => "yes")), "comments" => $comments_html));
    //Подключаем подвал
    $html .= template_get('footer');
    return $html;
}
开发者ID:jsib,项目名称:dumps.loc,代码行数:26,代码来源:message.php

示例15: flickr_push_subscriptions_get_by_user_and_topic

function flickr_push_subscriptions_get_by_user_and_topic(&$user, $topic_id, $topic_args = null)
{
    if ($topic_args) {
        $topic_args = json_encode($topic_args);
    }
    $cache_key = "flickr_push_subscriptions_user_{$user['id']}_{$topic_id}";
    if ($topic_args) {
        $cache_key .= "#" . md5($topic_args);
    }
    $cache = cache_get($cache_key);
    if ($cache['ok']) {
        $row = $cache['data'];
    } else {
        $enc_id = AddSlashes($user['id']);
        $enc_topic = AddSlashes($topic_id);
        $enc_args = $topic_args ? AddSlashes($topic_args) : "";
        $sql = "SELECT * FROM FlickrPushSubscriptions WHERE user_id='{$enc_id}' AND topic_id='{$enc_topic}' AND topic_args='{$enc_args}'";
        $rsp = db_fetch($sql);
        $row = db_single($rsp);
        if ($row) {
            cache_set($cache_key, $row, "cache locally");
        }
    }
    return $row;
}
开发者ID:rdhyee,项目名称:parallel-flickr,代码行数:25,代码来源:lib_flickr_push_subscriptions.php


注:本文中的db_fetch函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。