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


PHP db_error函数代码示例

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


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

示例1: onSubmit

    function onSubmit($vals)
    {
        //echo '<pre>';
        //print_r ($vals);
        //exit;
        $duration = (strtotime($vals['ended']) - strtotime($vals['started'])) / 60 / 60;
        $res = db_execute('insert into timetracker_entry
				(id, project_id, task_description, started, duration)
			values
				(null, ?, ?, ?, ?)', $vals['project'], $vals['description'], $vals['started'], $duration);
        if (!$res) {
            return '<p>Unknown error: ' . db_error() . '</p>';
        }
        $eid = db_lastid();
        if (!is_array($vals['users'])) {
            $vals['users'] = preg_split('/, ?/', $vals['users']);
        }
        foreach ($vals['users'] as $user) {
            db_execute('insert into timetracker_user_entry
					(id, user_id, entry_id)
				values
					(null, ?, ?)', $user, $eid);
        }
        header('Location: ' . site_prefix() . '/index/timetracker-app/added.entry');
        exit;
    }
开发者ID:vojtajina,项目名称:sitellite,代码行数:26,代码来源:index.php

示例2: 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

示例3: getContent

 function getContent()
 {
     $html_my_bookmarks = '';
     $result = db_query("SELECT bookmark_url, bookmark_title, bookmark_id from user_bookmarks where " . "user_id='" . user_getid() . "' ORDER BY bookmark_title");
     $rows = db_numrows($result);
     if (!$result || $rows < 1) {
         $html_my_bookmarks .= $GLOBALS['Language']->getText('my_index', 'no_bookmark');
         $html_my_bookmarks .= db_error();
     } else {
         $purifier = Codendi_HTMLPurifier::instance();
         $html_my_bookmarks .= '<table style="width:100%">';
         for ($i = 0; $i < $rows; $i++) {
             $bookmark_url = $purifier->purify(db_result($result, $i, 'bookmark_url'), CODENDI_PURIFIER_CONVERT_HTML);
             if (my_has_URL_invalid_content($bookmark_url)) {
                 $bookmark_url = '';
             }
             $bookmark_title = $purifier->purify(db_result($result, $i, 'bookmark_title'), CODENDI_PURIFIER_CONVERT_HTML);
             $html_my_bookmarks .= '<TR class="' . util_get_alt_row_color($i) . '"><TD>';
             $html_my_bookmarks .= '<A HREF="' . $bookmark_url . '">' . $bookmark_title . '</A> ';
             $html_my_bookmarks .= '<small><A HREF="/my/bookmark_edit.php?bookmark_id=' . db_result($result, $i, 'bookmark_id') . '">[' . $GLOBALS['Language']->getText('my_index', 'edit_link') . ']</A></SMALL></TD>';
             $html_my_bookmarks .= '<td style="text-align:right"><A HREF="/my/bookmark_delete.php?bookmark_id=' . db_result($result, $i, 'bookmark_id') . '">';
             $html_my_bookmarks .= '<IMG SRC="' . util_get_image_theme("ic/trash.png") . '" HEIGHT="16" WIDTH="16" BORDER="0" ALT="DELETE"></A></td></tr>';
         }
         $html_my_bookmarks .= '</table>';
     }
     $html_my_bookmarks .= '<div style="text-align:center; font-size:0.8em;"><a href="/my/bookmark_add.php">[' . $GLOBALS['Language']->getText('my_index', 'add_bookmark') . ']</a></div>';
     return $html_my_bookmarks;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:28,代码来源:Widget_MyBookmarks.class.php

示例4: smarty_function_catalog_detail

function smarty_function_catalog_detail($params, &$smarty1)
{
    global $smarty;
    global $db;
    global $cfg;
    $tbl_columns = $cfg['tbl_columns'];
    if (empty($params['template'])) {
        $template = "catalog_detail.html";
    }
    if (empty($params['catalog_id'])) {
        print "function article_detail required catalog_id";
        return;
    }
    extract($params);
    if (!isset($assign) && $smarty->is_cached($template, $catalog_id)) {
        $smarty->display($template, $catalog_id);
        return;
    }
    $sql = "select id,name,type,show_position,show_in_guide,url from {$tbl_columns} where id =" . intval($catalog_id) . " limit 1";
    $catalog = $db->GetRow($sql);
    if (!$catalog) {
        db_error();
    }
    if (isset($assign)) {
        $smarty->assign($assign, $catalog);
    } else {
        $smarty->assign("catalog", $catalog);
        $smarty->display($template, $catalog_id);
        $smarty->clear_assign("catalog");
    }
}
开发者ID:BGCX261,项目名称:zhishuicms-svn-to-git,代码行数:31,代码来源:function.catalog_detail.php

示例5: ReportProjectAct

 function ReportProjectAct($span, $group_id, $start = 0, $end = 0)
 {
     $this->Report();
     if (!$start) {
         $start = mktime(0, 0, 0, date('m'), 1, date('Y'));
     }
     if (!$end) {
         $end = time();
     } else {
         $end--;
     }
     if (!$group_id) {
         $this->setError('No group_id');
         return false;
     }
     if (!$span || $span == REPORT_TYPE_MONTHLY) {
         $res = db_query("SELECT * FROM rep_group_act_monthly \n\t\t\tWHERE group_id='{$group_id}' AND month BETWEEN '{$start}' AND '{$end}' ORDER BY month");
     } elseif ($span == REPORT_TYPE_WEEKLY) {
         $res = db_query("SELECT * FROM rep_group_act_weekly \n\t\t\tWHERE group_id='{$group_id}' AND week BETWEEN '{$start}' AND '{$end}' ORDER BY week");
     } elseif ($span == REPORT_TYPE_DAILY) {
         $res = db_query("SELECT * FROM rep_group_act_daily \n\t\t\tWHERE group_id='{$group_id}' AND day BETWEEN '{$start}' AND '{$end}' ORDER BY day ASC");
     }
     $this->start_date = $start;
     $this->end_date = $end;
     if (!$res || db_error()) {
         $this->setError('ReportProjectAct:: ' . db_error());
         return false;
     }
     $this->setSpan($span);
     $this->setDates($res, 1);
     $this->res = $res;
     return true;
 }
开发者ID:neymanna,项目名称:fusionforge,代码行数:33,代码来源:ReportProjectAct.class.php

示例6: sitemap_build

function sitemap_build($action, $settings, $board)
{
    global $config;
    // Possible values for $action:
    //	- all (rebuild everything, initialization)
    //	- news (news has been updated)
    //	- boards (board list changed)
    //	- post (a post has been made)
    //	- thread (a thread has been made)
    if ($action != 'post-thread' && $action != 'post-delete') {
        return;
    }
    if ($settings['regen_time'] > 0) {
        if ($last_gen = @filemtime($settings['path'])) {
            if (time() - $last_gen < (int) $settings['regen_time']) {
                return;
            }
            // Too soon
        }
    }
    $boards = explode(' ', $settings['boards']);
    $threads = array();
    foreach ($boards as $board) {
        $query = query(sprintf("SELECT `id` AS `thread_id`, (SELECT `time` FROM ``posts_%s`` WHERE `thread` = `thread_id` OR `id` = `thread_id` ORDER BY `time` DESC LIMIT 1) AS `lastmod` FROM ``posts_%s`` WHERE `thread` IS NULL", $board, $board)) or error(db_error());
        $threads[$board] = $query->fetchAll(PDO::FETCH_ASSOC);
    }
    file_write($settings['path'], Element('themes/sitemap/sitemap.xml', array('settings' => $settings, 'config' => $config, 'threads' => $threads, 'boards' => $boards)));
}
开发者ID:2Rainbow,项目名称:fukuro,代码行数:28,代码来源:theme.php

示例7: remove

 public function remove()
 {
     $q = $this->_getQuery();
     $q->setDelete('modules');
     $q->addWhere('mod_id = ' . (int) $this->mod_id);
     if (!$q->exec()) {
         $q->clear();
         return db_error();
     } else {
         if (!isset($this->mod_admin)) {
             $this->mod_admin = 0;
         }
         if ($this->mod_admin) {
             $this->_perms->deleteGroupItem($this->mod_directory, 'admin');
         } else {
             $this->_perms->deleteGroupItem($this->mod_directory, 'non_admin');
         }
         $this->_perms->deleteModuleItems($this->mod_directory);
         $this->_perms->deleteModule($this->mod_directory);
         if (isset($this->permissions_item_table) && $this->permissions_item_table) {
             $this->_perms->deleteModuleSection($this->permissions_item_table);
         }
         $this->_compactModuleUIOrder();
         return null;
     }
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:26,代码来源:Module.class.php

示例8: add_canned_response

/**
 * add_canned_response() - Add a new canned response
 *
 * @param		string	Canned response title
 * @param		string	Canned response text
 */
function add_canned_response($title, $text)
{
    global $feedback;
    if (!db_query("INSERT INTO canned_responses (response_title, response_text) VALUES('{$title}','{$text}')")) {
        $feedback .= db_error();
    }
}
开发者ID:neymanna,项目名称:fusionforge,代码行数:13,代码来源:canned_responses.php

示例9: showDependentTasks

    function showDependentTasks()
    {
        $sql = "SELECT project_task.project_task_id,project_task.summary \n\t\t\tFROM project_task,project_dependencies \n\t\t\tWHERE project_task.project_task_id=project_dependencies.project_task_id \n\t\t\tAND project_dependencies.is_dependent_on_task_id='" . $this->getID() . "'";
        $result = db_query($sql);
        $rows = db_numrows($result);
        if ($rows > 0) {
            echo '
			<h3>' . _('Tasks That Depend on This Task') . '</h3>
			<p>';
            $title_arr = array();
            $title_arr[] = _('Task Id');
            $title_arr[] = _('Task Summary');
            echo $GLOBALS['HTML']->listTableTop($title_arr);
            for ($i = 0; $i < $rows; $i++) {
                echo '
				<tr ' . $GLOBALS['HTML']->boxGetAltRowStyle($i) . '>
					<td>' . util_make_link('/pm/task.php?func=detailtask&project_task_id=' . db_result($result, $i, 'project_task_id') . '&group_id=' . $this->ProjectGroup->Group->getID() . '&group_project_id=' . $this->ProjectGroup->getID(), db_result($result, $i, 'project_task_id')) . '</td>
					<td>' . db_result($result, $i, 'summary') . '</td></tr>';
            }
            echo $GLOBALS['HTML']->listTableBottom();
        } else {
            echo '
				<h3>' . _('No Tasks are Dependent on This Task') . '</h3>';
            echo db_error();
        }
    }
开发者ID:neymanna,项目名称:fusionforge,代码行数:26,代码来源:ProjectTaskHTML.class.php

示例10: ReportUserAdded

 function ReportUserAdded($span, $start = 0, $end = 0)
 {
     $this->Report();
     if (!$start) {
         $start = mktime(0, 0, 0, date('m'), 1, date('Y'));
     }
     if (!$end) {
         $end = time();
     } else {
         $end--;
     }
     if (!$span || $span == REPORT_TYPE_MONTHLY) {
         $res = db_query("SELECT * FROM rep_users_added_monthly \n\t\t\tWHERE month BETWEEN '{$start}' AND '{$end}' ORDER BY month");
     } elseif ($span == REPORT_TYPE_WEEKLY) {
         $res = db_query("SELECT * FROM rep_users_added_weekly \n\t\t\tWHERE week BETWEEN '{$start}' AND '{$end}' ORDER BY week");
     } elseif ($span == REPORT_TYPE_DAILY) {
         $res = db_query("SELECT * FROM rep_users_added_daily \n\t\t\tWHERE day BETWEEN '{$start}' AND '{$end}' ORDER BY day ASC");
     }
     $this->start_date = $start;
     $this->end_date = $end;
     if (!$res || db_error()) {
         $this->setError('ReportUserAdded:: ' . db_error());
         return false;
     }
     $this->setSpan($span);
     $this->setDates($res, 0);
     $this->setData($res, 1);
     return true;
 }
开发者ID:neymanna,项目名称:fusionforge,代码行数:29,代码来源:ReportUserAdded.class.php

示例11: unban

function unban($id)
{
    $query = prepare("DELETE FROM `bans` WHERE `id` = :id");
    $query->bindValue(':id', $id);
    $query->execute() or error(db_error($query));
    modLog("Removed ban #{$id}");
}
开发者ID:npfriday,项目名称:Tinyboard,代码行数:7,代码来源:ban.php

示例12: options_submit

function options_submit()
{
    global $calendar_name, $vars, $db;
    if (!is_admin()) {
        return tag('div', _('Permission denied'));
    }
    $query = "UPDATE " . SQL_PREFIX . "calendars SET\n";
    if (isset($vars['hours_24'])) {
        $query .= "hours_24 = 1,\n";
    } else {
        $query .= "hours_24 = 0,\n";
    }
    if (isset($vars['start_monday'])) {
        $query .= "start_monday = 1,\n";
    } else {
        $query .= "start_monday = 0,\n";
    }
    if (isset($vars['translate'])) {
        $query .= "translate = 1,\n";
    } else {
        $query .= "translate = 0,\n";
    }
    $query .= "anon_permission = '{$vars['anon_permission']}',\n" . "calendar_title = '{$vars['calendar_title']}',\n" . "subject_max = '{$vars['subject_max']}'\n" . "WHERE calendar={$calendar_name};";
    $result = $db->Execute($query) or db_error(_('Error reading options'), $query);
    return tag('div', _('Updated options'));
}
开发者ID:noprom,项目名称:cryptdb,代码行数:26,代码来源:options_submit.php

示例13: store

 function store()
 {
     $msg = $this->check();
     if ($msg) {
         return get_class($this) . "::store-check failed";
     }
     $q = new DBQuery();
     if ($this->user_id) {
         // save the old password
         $perm_func = "updateLogin";
         $q->addTable('users');
         $q->addQuery('user_password');
         $q->addWhere("user_id = {$this->user_id}");
         $pwd = $q->loadResult();
         if ($pwd != $this->user_password) {
             $this->user_password = md5($this->user_password);
             addHistory($this->_tbl, $this->user_id, 'password changed', 'Password changed from IP ' . $_SERVER['REMOTE_ADDR']);
         } else {
             $this->user_password = null;
         }
         $ret = db_updateObject('users', $this, 'user_id', false);
     } else {
         $perm_func = "addLogin";
         $this->user_password = md5($this->user_password);
         $ret = db_insertObject('users', $this, 'user_id');
     }
     if (!$ret) {
         return get_class($this) . "::store failed <br />" . db_error();
     } else {
         $acl =& $GLOBALS['AppUI']->acl();
         $acl->{$perm_func}($this->user_id, $this->user_username);
         return NULL;
     }
 }
开发者ID:illuminate3,项目名称:dotproject,代码行数:34,代码来源:admin.class.php

示例14: login

 public static function login($name, $email, $user)
 {
     if (!$name || !$user) {
         throw new Exception('Wypełnij wszystkie pola.');
     }
     $user = new ChatUser(array('name' => $name, 'gravatar' => $user));
     include_once "../db_connect.php";
     include_once "../include/ust.php";
     $Querys = 'SELECT * FROM ' . $pre . 'user WHERE user_id=' . $_SESSION['user_id'] . '';
     $results = db_query($Querys) or die(db_error());
     while ($rows = db_fetch($results)) {
         $ile_pkt = $rows['user_money'];
         if ($rows['user_vip'] >= time()) {
             $czy_vp = 1;
         }
         $user_chat = $rows['user_chat'];
     }
     if ($user_chat == 1) {
         throw new Exception('Masz zablokowany dostęp do czatu.');
     }
     if ($czy_vp != 1) {
         if ($ile_pkt > $ust['chatp']) {
             $up = "UPDATE " . $pre . "user SET user_money=user_money-" . $ust['chatp'] . " WHERE user_id='" . db_real_escape_string($_SESSION['user_id']) . "'";
             db_query($up);
         } else {
             throw new Exception('Masz zamało punktów by dołączyć do czatu.');
         }
     }
     // The save method returns a MySQLi object
     if ($user->save()->affected_rows != 1) {
         throw new Exception('Nick jest zajęty.');
     }
     $_SESSION['user'] = array('name' => $name, 'gravatar' => $user);
     return array('status' => 1, 'name' => $name, 'gravatar' => $user);
 }
开发者ID:kardi31,项目名称:ogl,代码行数:35,代码来源:Chat.class.php

示例15: db_exec

function db_exec($sql)
{
    global $db, $w2p_performance_dbtime, $w2p_performance_old_dbqueries;
    if (W2P_PERFORMANCE_DEBUG) {
        $startTime = array_sum(explode(' ', microtime()));
    }
    if (!is_object($db)) {
        dprint(__FILE__, __LINE__, 0, 'Database object does not exist.');
    }
    $qid = $db->Execute($sql);
    dprint(__FILE__, __LINE__, 10, $sql);
    if ($msg = db_error()) {
        global $AppUI;
        dprint(__FILE__, __LINE__, 0, "Error executing: <pre>{$sql}</pre>");
        // Useless statement, but it is being executed only on error,
        // and it stops infinite loop.
        $db->Execute($sql);
        if (!db_error()) {
            echo '<script language="JavaScript"> location.reload(); </script>';
        }
    }
    if (!$qid && preg_match('/^\\<select\\>/i', $sql)) {
        dprint(__FILE__, __LINE__, 0, $sql);
    }
    if (W2P_PERFORMANCE_DEBUG) {
        ++$w2p_performance_old_dbqueries;
        $w2p_performance_dbtime += array_sum(explode(' ', microtime())) - $startTime;
    }
    return $qid;
}
开发者ID:joly,项目名称:web2project,代码行数:30,代码来源:db_adodb.php


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