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


PHP db_result函数代码示例

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


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

示例1: snippet_data_get_license_from_id

function snippet_data_get_license_from_id($license_id)
{
    $license_id = (int) $license_id;
    $sql = "SELECT license_name FROM snippet_license WHERE license_id=" . db_ei($license_id);
    $result = db_query($sql);
    return db_result($result, 0, 0);
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:7,代码来源:snippet_data.php

示例2: forum_show_nested_messages

function forum_show_nested_messages($thread_id, $msg_id)
{
    global $total_rows, $Language;
    $sql = "SELECT user.user_name,forum.has_followups,user.realname,user.user_id,forum.msg_id,forum.group_forum_id,forum.subject,forum.thread_id,forum.body,forum.date,forum.is_followup_to, forum_group_list.group_id " . "FROM forum,user,forum_group_list WHERE forum.thread_id=" . db_ei($thread_id) . " AND user.user_id=forum.posted_by AND forum.is_followup_to=" . db_ei($msg_id) . " AND forum_group_list.group_forum_id = forum.group_forum_id " . "ORDER BY forum.date ASC;";
    $result = db_query($sql);
    $rows = db_numrows($result);
    $ret_val = '';
    if ($result && $rows > 0) {
        $ret_val .= '
			<UL>';
        /*
        	iterate and show the messages in this result
        	for each message, recurse to show any submessages
        */
        for ($i = 0; $i < $rows; $i++) {
            //	increment the global total count
            $total_rows++;
            //	show the actual nested message
            $ret_val .= forum_show_a_nested_message($result, $i) . '<P>';
            if (db_result($result, $i, 'has_followups') > 0) {
                //	Call yourself if there are followups
                $ret_val .= forum_show_nested_messages($thread_id, db_result($result, $i, 'msg_id'));
            }
        }
        $ret_val .= '
			</UL>';
    }
    return $ret_val;
}
开发者ID:nterray,项目名称:tuleap,代码行数:29,代码来源:forum.php

示例3: display

 function display($data)
 {
     echo '<fieldset><legend style="font-size:1.2em;">Choose the template of the project</legend>';
     include $GLOBALS['Language']->getContent('project/template');
     $rows = db_numrows($this->db_templates);
     if ($rows > 0) {
         //echo '<h3>From templates</h3><blockquote>';
         $GLOBALS['HTML']->box1_top($GLOBALS['Language']->getText('register_template', 'choose'));
         print '
       <TABLE width="100%">';
         for ($i = 0; $i < $rows; $i++) {
             $this->_displayProject(db_result($this->db_templates, $i, 'group_id'), db_result($this->db_templates, $i, 'group_name'), db_result($this->db_templates, $i, 'register_time'), db_result($this->db_templates, $i, 'unix_group_name'), db_result($this->db_templates, $i, 'short_description'));
         }
         print '</TABLE>';
         $GLOBALS['HTML']->box1_bottom();
         //echo '</blockquote>';
     }
     //{{{ Projects where current user is admin
     $result = db_query("SELECT groups.group_name AS group_name, " . "groups.group_id AS group_id, " . "groups.unix_group_name AS unix_group_name, " . "groups.register_time AS register_time, " . "groups.short_description AS short_description " . "FROM groups, user_group " . "WHERE groups.group_id = user_group.group_id " . "AND user_group.user_id = '" . user_getid() . "' " . "AND user_group.admin_flags = 'A' " . "AND groups.status='A' ORDER BY group_name");
     echo db_error($result);
     $rows = db_numrows($result);
     if ($result && $rows) {
         include $GLOBALS['Language']->getContent('project/template_my');
         echo '<br />';
         $GLOBALS['HTML']->box1_top($GLOBALS['Language']->getText('register_template', 'choose_admin'));
         print '<TABLE width="100%">';
         for ($i = 0; $i < $rows; $i++) {
             $this->_displayProject(db_result($result, $i, 'group_id'), db_result($result, $i, 'group_name'), db_result($result, $i, 'register_time'), db_result($result, $i, 'unix_group_name'), db_result($result, $i, 'short_description'));
         }
         print '</TABLE>';
         $GLOBALS['HTML']->box1_bottom();
     }
     //}}}
     echo '</fieldset>';
 }
开发者ID:nterray,项目名称:tuleap,代码行数:35,代码来源:RegisterProjectStep_Template.class.php

示例4: display

function display($label, $date)
{
    echo "<td>{$label}</td>";
    $datestr = date('j/m/y H:i', $date);
    echo "<td>{$datestr}</td>";
    $res = db_query("SELECT count(*) access FROM user WHERE last_access_date >= {$date}");
    if (db_numrows($res)) {
        $cntlast = db_result($res, 0, 'access');
    }
    echo "<td>{$cntlast}</td>";
    $res = db_query("SELECT count(*) access FROM user WHERE last_access_date >= {$date} AND email LIKE '%@orange.com'");
    if (db_numrows($res)) {
        $cntft = db_result($res, 0, 'access');
    }
    $percentft = round($cntft * 100 / $cntlast, 2);
    echo "<td>{$cntft} en @orange.com [{$percentft} %]</td>";
    $res = db_query("SELECT count(*) access FROM user WHERE last_access_date >= {$date} AND email LIKE '%.ext@orange.com'");
    if (db_numrows($res)) {
        $cntext = db_result($res, 0, 'access');
    }
    $percentext = round($cntext * 100 / $cntlast, 2);
    echo "<td>dont {$cntext} en .ext@orange.com [{$percentext} %]</td>";
    $cntother = $cntlast - $cntft;
    $percentother = round($cntother * 100 / $cntlast, 2);
    echo "<td>et autres {$cntother} [{$percentother} %]</td>";
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:26,代码来源:count_access.php

示例5: __mergeWithExisting

 private function __mergeWithExisting(&$edit)
 {
     if (1 != db_result(db_query("SELECT COUNT(*) FROM {vocabulary} WHERE name = '%s'", $edit['name']))) {
         return;
     }
     $edit['vid'] = db_result(db_query("SELECT vid FROM {vocabulary} WHERE name = '%s'", $edit['name']));
 }
开发者ID:pounard,项目名称:yamm,代码行数:7,代码来源:Vocabulary.php

示例6: faq_count_query

function faq_count_query($p_project_id)
{
    global $g_mantis_faq_table;
    $query = "SELECT COUNT(*)\n\t\t\t\tFROM {$g_mantis_faq_table}\n\t\t\t\tWHERE project_id='{$p_project_id}' OR project_id='0000000'";
    $result = db_query_bound($query);
    return db_result($result, 0, 0);
}
开发者ID:xxNull-lsk,项目名称:faq,代码行数:7,代码来源:faq_api.php

示例7: run

    function run($max_time) {
        foreach (array(
                'registration-staff', 'pwreset-staff', 'banner-staff',
                'registration-client', 'pwreset-client', 'banner-client',
                'registration-confirm', 'registration-thanks',
                'access-link') as $type) {
            $i18n = new Internationalization();
            $tpl = $i18n->getTemplate("templates/page/{$type}.yaml");
            if (!($page = $tpl->getData()))
                // No such template on disk
                continue;

            if ($id = db_result(db_query('select id from '.PAGE_TABLE
                    .' where `type`='.db_input($type))))
                // Already have a template for the content type
                continue;

            $sql = 'INSERT INTO '.PAGE_TABLE.' SET type='.db_input($type)
                .', name='.db_input($page['name'])
                .', body='.db_input($page['body'])
                .', lang='.db_input($tpl->getLang())
                .', notes='.db_input($page['notes'])
                .', created=NOW(), updated=NOW(), isactive=1';
            db_query($sql);
        }
        // Set the content_id for all the new items
        db_query('UPDATE '.PAGE_TABLE
            .' SET `content_id` = `id` WHERE `content_id` = 0');
    }
开发者ID:KingsleyGU,项目名称:osticket,代码行数:29,代码来源:f5692e24-4323a6a8.task.php

示例8: get_themename

function get_themename($theme_id = 0)
{
    global $THEME_NAME;
    // use current theme if one is not passed in
    if (!$theme_id) {
        return $THEME_NAME ? $THEME_NAME["theme_{$theme_id}"] : $GLOBALS['sys_theme'];
    } else {
        if ($THEME_NAME["theme_{$theme_id}"]) {
            //theme name was fetched previously
            return $THEME_NAME["theme_{$theme_id}"];
        } else {
            //fetch the theme name and store it for future reference
            $result = db_query("SELECT theme_id,fullname FROM themes WHERE theme_id='{$theme_id}'");
            if ($result && db_numrows($result) > 0) {
                //valid theme - store and return
                $THEME_NAME["theme_{$theme_id}"] = db_result($result, 0, "fullname");
                return $THEME_NAME["theme_{$theme_id}"];
            } else {
                //invalid theme - store and return
                $THEME_NAME["theme_{$theme_id}"] = "<B>Invalid Theme ID</B>";
                return $THEME_NAME["theme_{$theme_id}"];
            }
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:berlios,代码行数:25,代码来源:theme.php

示例9: Widget_MySurveys

 function Widget_MySurveys()
 {
     $this->Widget('mysurveys');
     $no_survey = true;
     // Get id and title of the survey that will be promoted to user page. default = survey whose id=1
     if ($GLOBALS['sys_my_page_survey']) {
         $developer_survey_id = $GLOBALS['sys_my_page_survey'];
     } else {
         $developer_survey_id = "1";
     }
     $survey = SurveySingleton::instance();
     $sql = "SELECT * from surveys WHERE survey_id=" . db_ei($developer_survey_id);
     $result = db_query($sql);
     $group_id = db_result($result, 0, 'group_id');
     $purifier = Codendi_HTMLPurifier::instance();
     $survey_title = $purifier->purify($survey->getSurveyTitle(db_result($result, 0, 'survey_title')));
     // Check that the survey is active
     $devsurvey_is_active = db_result($result, 0, 'is_active');
     if ($devsurvey_is_active == 1) {
         $sql = "SELECT * FROM survey_responses " . "WHERE survey_id='" . db_ei($developer_survey_id) . "' AND user_id='" . db_ei(user_getid()) . "'";
         $result = db_query($sql);
         if (db_numrows($result) < 1) {
             $no_survey = false;
             $this->content .= '<a href="/survey/survey.php?group_id=' . $group_id . '&survey_id=' . $developer_survey_id . '">' . $survey_title . '</a>';
         }
     }
     if ($no_survey) {
         $this->content .= $GLOBALS['Language']->getText('my_index', 'no_survey');
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:30,代码来源:Widget_MySurveys.class.php

示例10: getRows

    /**
     * getRows - get the html output for result rows
     *
     * @return string html output
     */
    function getRows()
    {
        $rowsCount = $this->searchQuery->getRowsCount();
        $result =& $this->searchQuery->getResult();
        $monthArray = array();
        for ($i = 1; $i <= 12; $i++) {
            array_push($monthArray, date('M', mktime(0, 0, 0, $i, 10, 1980)));
        }
        $return = '';
        for ($i = 0; $i < $rowsCount; $i++) {
            $start = db_result($result, $i, 'start');
            $startYear = substr($start, 0, 4);
            $startMonth = substr($start, 4, 2);
            $finish = db_result($result, $i, 'finish');
            $finishYear = substr($finish, 0, 4);
            $finishMonth = substr($finish, 4, 2);
            $return .= '
			<tr ' . $GLOBALS['HTML']->boxGetAltRowStyle($i) . '>
				<td>' . util_make_link_u(db_result($result, $i, 'user_name'), db_result($result, $i, 'user_id'), db_result($result, $i, 'realname')) . '</td>
				<td>' . db_result($result, $i, 'type_name') . '</td>
				<td>' . db_result($result, $i, 'title') . '</td>
				<td>' . db_result($result, $i, 'keywords') . '</td>
				<td>' . $monthArray[$startMonth - 1] . ' ' . $startYear . '</td>
				<td>' . $monthArray[$finishMonth - 1] . ' ' . $finishYear . '</td>
			<tr>';
        }
        return $return;
    }
开发者ID:neymanna,项目名称:fusionforge,代码行数:33,代码来源:SkillHtmlSearchRenderer.class.php

示例11: sigControl

function sigControl()
{
    global $pref, $board_time;
    $r_log = db_query("SELECT\n         user_ismod,\n         user_isadmin,\n         ad_sig,\n         ad_time\n     FROM " . $pref . "user WHERE user_id='{$_SESSION['userid']}'");
    if (db_rows($r_log) != 1) {
        return 0;
    } else {
        $a_log = db_result($r_log);
        $ismod = 0;
        if ($a_log['user_ismod'] == 1 || $a_log['user_isadmin'] == 1) {
            $ismod = 1;
        }
        $sigok = 0;
        if ($a_log['ad_sig'] == $_SESSION['adsig']) {
            $sigok = 1;
        }
        $timeok = 0;
        if ($a_log['ad_time'] > $board_time - 600) {
            $timeok = 1;
        }
        if ($ismod == 1 && $sigok == 1 && $timeok == 1) {
            return 1;
        } else {
            return 0;
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:thwc,代码行数:27,代码来源:modhead.inc.php

示例12: gbook_content

function gbook_content()
{
    global $p;
    $result = db_result("SELECT * FROM " . DB_PREFIX . "guestbook ORDER BY date DESC LIMIT " . @$p * 10 . ",10");
    $text = "<a name=\"content\" ></a>\r\n";
    $o = 1;
    while ($row = mysql_fetch_object($result)) {
        $text .= "<div class=\"gb_content\">\r\n\t<div class=\"gb_content_info\">\r\n\t\t<span class=\"gb_content_info_name\">";
        if ($row->mail != "") {
            $text .= "<a href=\"mailto:" . $row->mail . "\">" . $row->name . "</a>";
        } else {
            $text .= $row->name;
        }
        $text .= "</span>\r\n";
        if ($row->icq != '') {
            $text .= "\t\t<span class=\"gb_content_info_icq\">\r\n\t\t\t<a href=\"http://wwp.icq.com/scripts/search.dll?to=" . $row->icq . "\" target=\"_blank\">\r\n\t\t\t\t<img width=\"18\"  height=\"18\" class=\"gb_content_info_icq\" src=\"http://status.icq.com/online.gif?icq=" . $row->icq . "&amp;img=5\" alt=\"ICQ-Status\"/>\r\n\t\t\t</a>\r\n\t\t</span>\r\n";
        }
        if ($row->homepage != '') {
            $text .= "\t\t<span class=\"gb_content_info_homepage\">\r\n\t\t\t<a href=\"http://" . $row->homepage . "\">Homepage</a>\r\n\t\t</span>\r\n";
        }
        $text .= "\t</div>\r\n";
        $time = date('H:i:s', $row->date);
        if ($time == '00:00:00') {
            $time = '';
        }
        $text .= "\t<div class=\"gb_content_text\">" . replace_smilies(nl2br(htmlspecialchars($row->message))) . "\r\n\t\t<div class=\"gb_content_date\">" . date('d.m.Y', $row->date) . "&nbsp;" . $time . "</div>\r\n\t</div>\r\n</div>\r\n\r\n";
        $o++;
    }
    return $text;
}
开发者ID:BackupTheBerlios,项目名称:comacms-svn,代码行数:30,代码来源:gbook.php

示例13: actual_online

function actual_online()
{
    global $internal_counter_online_text, $internal_counter_online;
    $sql = "SELECT * \n\t\t\tFROM " . DB_PREFIX . "online";
    $result = db_result($sql);
    $internal_counter_online = mysql_num_rows($result);
    //
    // FIX ME: no language
    //
    $lang = 'de';
    $temp = $lang . '_count';
    global ${$temp}, ${$lang};
    $text_array = ${$temp};
    $plural_array = ${$lang};
    if (count($text_array) - 1 > $internal_counter_online) {
        $text = $text_array[$internal_counter_online];
    } else {
        $text = $internal_counter_online;
    }
    if ($internal_counter_online > 1) {
        $internal_counter_online_text = $plural_array[1] . ' ' . $text;
    } else {
        $internal_counter_online_text = $plural_array[0] . ' ' . $text;
    }
}
开发者ID:BackupTheBerlios,项目名称:comacms-svn,代码行数:25,代码来源:counter.php

示例14: del_same_editor_rights

function del_same_editor_rights()
{
    /*Проверка прав на выполнение действия*/
    if (!check_rights('add_same_editor_rights')) {
        return "У вас нет соответствующих прав";
    }
    /*Получаем и проверяем данные от пользователя*/
    $editor_id = (int) $_GET['editor'];
    /*Получаем и проверяем данные от пользователя*/
    $user_id = (int) $_GET['user'];
    /*Проверка входных данных*/
    if (db_easy_count("SELECT * FROM `phpbb_users` WHERE `user_id`={$editor_id} AND `timetable_editor`=1") == 0) {
        return "Ошибка в формате входных данных (editor)";
    }
    /*Проверка входных данных*/
    if (db_easy_count("SELECT * FROM `phpbb_users` WHERE `user_id`={$user_id}") == 0) {
        return "Ошибка в формате входных данных (user)";
    }
    //Запрос к базе
    if (db_easy_count("SELECT * FROM `phpbb_timetable_editors_rights` WHERE `user_id`={$user_id} AND `editor_id`={$editor_id}") > 0) {
        $insertRES = db_query("DELETE FROM `phpbb_timetable_editors_rights` WHERE `user_id`={$user_id} AND `editor_id`={$editor_id}");
    }
    /*Проверка правильности выполнения запроса к БД*/
    if (!db_result($insertRES)) {
        return "Ошибка при выполнении (DELETE)";
    }
    //Выполняем HTTP запрос
    header("location: /manager.php?action=show_timetable_rights");
}
开发者ID:jsib,项目名称:intranet,代码行数:29,代码来源:del_same_editor_rights.php

示例15: page_admin_edit

function page_admin_edit($table, $field, $id)
{
    use_template("admin");
    requires_admin();
    global $tables;
    if (!isset($tables[$table]['liveedit'])) {
        die("can't edit this table tables[{$table}]['liveedit'] not set");
    }
    if (form_post("editor1")) {
        $html = form_post("editor1");
        $html = str_replace('\\"', '"', $html);
        $html = str_replace("\\'", "'", $html);
        $f = "on_{$table}_{$field}_update";
        if (function_exists($f)) {
            $f($id, $html);
        }
        db_query("UPDATE %s SET %s='%s' WHERE id=%d", $table, $field, $html, $id);
        if (CLOSE_ON_SAVE) {
            die("<script> window.close();</script>");
        }
    }
    $content = db_result(db_query("SELECT %s FROM %s WHERE id=%d", $field, $table, $id));
    $o = template("tinymce", "content", $content);
    return $o;
}
开发者ID:NazarK,项目名称:timedesk,代码行数:25,代码来源:tinymce.php


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