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


PHP DB::query_row方法代码示例

本文整理汇总了PHP中DB::query_row方法的典型用法代码示例。如果您正苦于以下问题:PHP DB::query_row方法的具体用法?PHP DB::query_row怎么用?PHP DB::query_row使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DB的用法示例。


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

示例1: getStatusUser

 public static function getStatusUser($user_id)
 {
     if (DB::query_row("SELECT * FROM `online_tb` WHERE `user_id` = '" . $user_id . "' && `date` >= '" . date("Y-m-d H:i:s", time() - 60 * 10) . "'")) {
         return true;
     }
     return false;
 }
开发者ID:belkov,项目名称:o3dshop,代码行数:7,代码来源:Online.class.php

示例2: getCount

 function getCount($aResultSQL)
 {
     $ex = explode("FROM ", $aResultSQL);
     unset($ex['0']);
     $count = DB::query_row("SELECT COUNT(DISTINCT(" . $this->count_field . ")) as count FROM " . implode(" ", $ex));
     return $count['count'];
 }
开发者ID:belkov,项目名称:o3dshop,代码行数:7,代码来源:Table.class.php

示例3: getMeta

 public static function getMeta($parentID, $table)
 {
     if ($meta = DB::query_row("SELECT * FROM `meta_tb` WHERE `parentID` = '" . DB::escape($parentID) . "' && `table` = '" . DB::escape($table) . "'")) {
         return $meta;
     }
     return false;
 }
开发者ID:belkov,项目名称:o3dshop,代码行数:7,代码来源:Meta.class.php

示例4: actionEdit

 function actionEdit()
 {
     $obj = DB::query_row("SELECT * FROM `" . $_GET['table'] . "` WHERE `id` = '" . $_GET['id'] . "'");
     $class = new $_GET['class']();
     $oForm = call_user_func(array($class, "form"), $obj);
     $oForm->setFunctionPostBack($this, "editForm");
     //echo $oForm->getForm("", "");die();
     return $this->InIndex("Редактирование " . $oForm->getFormName(), $oForm->getForm("", ""), 1);
 }
开发者ID:belkov,项目名称:o3dshop,代码行数:9,代码来源:Admin.class.php

示例5: _HCM_recentposts

function _HCM_recentposts($limit = null, $stranky = "", $typ = null)
{
    // priprava
    $result = "";
    if (isset($limit) and intval($limit) >= 1) {
        $limit = abs(intval($limit));
    } else {
        $limit = 10;
    }
    // filtr cisel sekci, knih nebo clanku
    if (isset($stranky) and isset($typ)) {
        $rtype = intval($typ);
        if ($rtype < 1 or $rtype > 3) {
            $rtype = 1;
        }
        $rroots = "(" . _sqlWhereColumn("home", $stranky) . ") AND type=" . $rtype;
    } else {
        $rroots = "type!=4 AND type!=6 AND type!=7";
    }
    $query = DB::query("SELECT id,type,home,xhome,subject,author,guest,time,text FROM `" . _mysql_prefix . "-posts` WHERE " . $rroots . " ORDER BY id DESC LIMIT " . $limit);
    while ($item = DB::row($query)) {
        // nacteni titulku a odkazu na stranku
        switch ($item['type']) {
            case 1:
            case 3:
                $hometitle = DB::query_row("SELECT title,title_seo FROM `" . _mysql_prefix . "-root` WHERE id=" . $item['home']);
                $homelink = _linkRoot($item['home'], $hometitle['title_seo']);
                break;
            case 2:
                $hometitle = DB::query_row("SELECT art.title,art.title_seo,cat.title_seo AS cat_title_seo FROM `" . _mysql_prefix . "-articles` AS art JOIN `" . _mysql_prefix . "-root` AS cat ON(cat.id=art.home1) WHERE art.id=" . $item['home']);
                $homelink = _linkArticle($item['home'], $hometitle['title_seo'], $hometitle['cat_title_seo']);
                break;
            case 5:
                if ($item['xhome'] == -1) {
                    $tid = $item['id'];
                    $hometitle = array("title" => $item['subject']);
                } else {
                    $tid = $item['xhome'];
                    $hometitle = DB::query_row("SELECT subject FROM `" . _mysql_prefix . "-posts` WHERE id=" . $item['xhome']);
                    $hometitle = array("title" => $hometitle['subject']);
                }
                $homelink = "index.php?m=topic&amp;id=" . $tid;
                break;
        }
        // nacteni jmena autora
        if ($item['author'] != -1) {
            $authorname = _linkUser($item['author'], null, true, true);
        } else {
            $authorname = $item['guest'];
        }
        $hometitle = $hometitle['title'];
        $result .= "\n<h2 class='list-title'><a href='" . $homelink . "'>" . $hometitle . "</a></h2>\n<p class='list-perex'>" . _cutStr(strip_tags(_parsePost($item['text'])), 256) . "</p>\n<div class='list-info'>\n<span>" . $GLOBALS['_lang']['global.postauthor'] . ":</span> " . $authorname . _template_listinfoseparator . "\n<span>" . $GLOBALS['_lang']['global.time'] . ":</span> " . _formatTime($item['time']) . "\n</div>\n\n";
    }
    return $result;
}
开发者ID:sunlight-cms,项目名称:sunlight-cms-7,代码行数:55,代码来源:recentposts.php

示例6: table

 function table($aRow)
 {
     $photo = Photo::getPhotoById($aRow['main']);
     $aRow['main'] = "<img src='" . $photo['path'] . "/thumb/" . $photo['name'] . "'>";
     if ($parent = DB::query_row("SELECT * FROM `category_tb` WHERE `id` = '" . DB::escape($aRow['categoryID']) . "'")) {
         $aRow['categoryID'] = $parent['name'];
     } else {
         $aRow['categoryID'] = "нет";
     }
     return $aRow;
 }
开发者ID:belkov,项目名称:o3dshop,代码行数:11,代码来源:Product.php

示例7: authorized

 public static function authorized($email, $password)
 {
     self::$user = DB::query_row('SELECT * FROM `user_tb` WHERE `email`="' . mysqli_real_escape_string(DB::$desc, $email) . '" && `passwd` = "' . mysqli_real_escape_string(DB::$desc, $password) . '" ');
     if (!self::$user) {
         return FALSE;
     }
     if (self::$user['isactive'] == 1) {
         return FALSE;
     }
     $_SESSION['session_id'] = self::$user['id'];
     return TRUE;
 }
开发者ID:belkov,项目名称:o3dshop,代码行数:12,代码来源:Auth.class.php

示例8: table

 function table($aRow)
 {
     if ($parent = DB::query_row("SELECT * FROM `category_tb` WHERE `id` = '" . DB::escape($aRow['categoryID']) . "'")) {
         $aRow['categoryID'] = $parent['name'];
     } else {
         $aRow['categoryID'] = "нет";
     }
     if (DB::query_row("SELECT * FROM `category_tb` WHERE `categoryID` = '" . $aRow['id'] . "'")) {
         $aRow['name'] = '<a href="/admin/ru/Category/Show/?categoryID=' . $aRow['id'] . '">' . $aRow['name'] . '</a>';
     }
     return $aRow;
 }
开发者ID:belkov,项目名称:o3dshop,代码行数:12,代码来源:Category.php

示例9: _HCM_linkart

function _HCM_linkart($id = null, $text = null, $nove_okno = false)
{
    if (null === $text) {
        $query = DB::query_row('SELECT art.title,art.title_seo,cat.title_seo AS cat_title_seo FROM `' . _mysql_prefix . '-articles` AS art JOIN `' . _mysql_prefix . '-root` AS cat ON(cat.id=art.home1) WHERE art.' . (is_numeric($id) ? 'id' : 'title_seo') . '=' . DB::val($id));
        if (false === $query) {
            return '{' . _htmlStr($id) . '}';
        }
        $text = $query['title'];
    } else {
        $query = array('title_seo' => null, 'cat_title_seo' => null);
    }
    return "<a href='" . _linkArticle($id, $query['title_seo'], $query['cat_title_seo']) . "'" . ($nove_okno ? ' target="_blank"' : '') . ">" . $text . "</a>";
}
开发者ID:sunlight-cms,项目名称:sunlight-cms-7,代码行数:13,代码来源:linkart.php

示例10: actionNews

 function actionNews()
 {
     if (isset($_GET['all'])) {
         DB::query("UPDATE `user_tb` SET `news` = '0' WHERE `id` = '" . $_SESSION['session_id'] . "'");
         $this->redirectTo("/news/");
     }
     $limit = ($_GET['page'] - 1) * $this->count . ", " . $this->count;
     $news = DB::query_array("SELECT * FROM `news_tb` ORDER BY `id` DESC LIMIT " . $limit);
     $cpartners = DB::query_row("SELECT COUNT(id) as count FROM `news_tb` ");
     if (ceil($cpartners['count'] / $this->count) > 1) {
         $this->oSmarty->assign("pagination", $this->getNavigationIndex($cpartners['count'], $this->count, "/news/", $_GET['page'], 10));
     }
     return $this->oSmarty->assign("news", $news)->fetch($_GET['region'] . "/Body/News.tpl");
 }
开发者ID:belkov,项目名称:o3dshop,代码行数:14,代码来源:Main.php

示例11: foreach

         $message = "<br /><ul>\n";
         foreach ($prev_count as $key => $val) {
             $message .= "<li><strong>" . $_lang[$key] . ":</strong> <code>" . $val . "</code></li>\n";
         }
         $message .= "</ul>";
     } else {
         $message = _formMessage(1, $_lang['global.done']);
     }
     break;
     // deinstalace
 // deinstalace
 case 2:
     $pass = $_POST['pass'];
     $confirm = _checkboxLoad("confirm");
     if ($confirm) {
         $right_pass = DB::query_row("SELECT password,salt FROM `" . _mysql_prefix . "-users` WHERE id=0");
         if (_md5Salt($pass, $right_pass['salt']) == $right_pass['password']) {
             // ziskani tabulek
             $tables = array();
             $q = DB::query('SHOW TABLES LIKE \'' . _mysql_prefix . '-%\'');
             while ($r = DB::rown($q)) {
                 $tables[] = $r[0];
             }
             // odstraneni tabulek
             foreach ($tables as $table) {
                 DB::query("DROP TABLE `" . $table . "`");
             }
             // zprava
             _userLogout();
             echo "<h1>" . $_lang['global.done'] . "</h1>\n<p>" . $_lang['admin.other.cleanup.uninstall.done'] . "</p>";
             exit;
开发者ID:sunlight-cms,项目名称:sunlight-cms-7,代码行数:31,代码来源:other-cleanup.php

示例12: call_user_func

    $oBaseModule->oSmarty->assign("user", Auth::getUser());
}
if (!isset($menu['class'])) {
    $oBaseModule->redirectTo("/404/");
}
$oProcess = new $menu['class']();
$action = $menu['method'] == "" ? "action" : "action" . $menu['method'];
call_user_func(array($oProcess, "init"), &$oBaseModule->oSmarty);
$CONTENT = call_user_func(array($oProcess, $action));
//echo $_SERVER['HTTP_ACCEPT'];die();
if (mb_strpos($_SERVER['HTTP_ACCEPT'], "json")) {
    echo json_encode(array('result' => $CONTENT));
    die;
} else {
    if ($CONTENT == null) {
        $oBaseModule->redirectTo("/404/");
    }
    $oBaseModule->oSmarty->assign("text", $CONTENT);
    header('Content-type: text/html; charset=utf-8');
    header("HTTP/1.1 200 OK", TRUE, 200);
    if (isset($_SESSION['session_id']) && is_file("i/profile/" . $_SESSION['session_id'] . ".jpg")) {
        $oBaseModule->oSmarty->assign("photo_profile", "/i/profile/" . $_SESSION['session_id'] . ".jpg");
    }
    $active = call_user_func(array($oProcess, "getActive"), &$oBaseModule->oSmarty);
    $oBaseModule->oSmarty->assign("active", $active);
    if (isset($_SESSION['session_id']) && $_SESSION['session_id'] != '') {
        echo $oBaseModule->oSmarty->assign("user_amount", number_format(Config::userAmount($_SESSION['session_id']), 0, ',', ' '))->assign("count_message", DB::query_row("SELECT COUNT(id) as count FROM `pmessage_tb` WHERE `status` = '1' && `user_id` = '" . $_SESSION['session_id'] . "'"))->assign("count_news", Auth::getUser("news"))->fetch($_GET['region'] . "/IndexFrontend.tpl");
    } else {
        echo $oBaseModule->oSmarty->fetch($_GET['region'] . "/IndexAuth.tpl");
    }
}
开发者ID:belkov,项目名称:o3dshop,代码行数:31,代码来源:index.php

示例13: deleteAction

 /**
  * Delete action
  * @param  array      $params
  * @param  array      $action
  * @param  AdminBread $bread
  * @return array
  */
 public static function deleteAction(array $params, array $action, AdminBread $bread)
 {
     $messages = array();
     $trigger = "_del_{$bread->uid}";
     /* ----- load data ----- */
     // verify ID
     if (!isset($params[1])) {
         return array(array('msg' => 'Missing parameter 1 for ' . __METHOD__), self::ACTION_ERR);
     }
     // process ID
     $id = (int) $params[1];
     // load data
     $sql = $bread->formatSql("SELECT %columns% FROM `" . $bread->formatTable($bread->table) . "` {$bread->tableAlias} WHERE {$bread->tableAlias}.{$bread->primary}=@id@", array('columns' => array_merge(array($bread->primary), $action['extra_columns']), 'id' => $id));
     $data = DB::query_row($sql);
     if (false === $data) {
         return array(null, self::ACTION_NOT_FOUND);
     }
     /* ----- delete ----- */
     if (isset($_POST[$trigger])) {
         // handler or simple delete
         if (null !== $action['handler']) {
             // use handler
             $success = call_user_func($action['handler'], array('data' => $data, 'params' => $params, 'action' => $action, 'bread' => $bread, 'messages' => &$messages));
         } else {
             // simple delete
             $success = DB::query($bread->formatSql("DELETE FROM `" . $bread->formatTable($bread->table) . "` WHERE {$bread->primary}=@id@ LIMIT 1", array('id' => $id)));
         }
         // handle result
         if ($success) {
             return array(array('messages' => $messages), self::ACTION_DONE);
         } else {
             $messages[] = array(2, $GLOBALS['_lang']['global.error']);
         }
     }
     /* ----- render ----- */
     return array(array('messages' => $messages), $bread->render($action['template'], array('data' => $data, 'self' => $params['action'], 'submit_text' => $GLOBALS['_lang']['admin.content.redir.act.wipe.submit'], 'submit_trigger' => $trigger)));
 }
开发者ID:sunlight-cms,项目名称:sunlight-cms-7,代码行数:44,代码来源:admin_bread.php

示例14: AND

     // forum
 // forum
 case 5:
     $tdata = DB::query("SELECT public,var2,var3,level FROM `" . _mysql_prefix . "-root` WHERE id=" . $posttarget . " AND type=8");
     if (DB::size($tdata) != 0) {
         $tdata = DB::row($tdata);
         if (_publicAccess($tdata['public'], $tdata['level']) and _publicAccess($tdata['var3']) and $tdata['var2'] != 1) {
             $continue = true;
         }
     }
     break;
     // zprava
 // zprava
 case 6:
     if (_messages && _loginindicator) {
         $tdata = DB::query_row('SELECT sender,receiver FROM `' . _mysql_prefix . '-pm` WHERE id=' . $posttarget . ' AND (sender=' . _loginid . ' OR receiver=' . _loginid . ') AND sender_deleted=0 AND receiver_deleted=0');
         if ($tdata !== false) {
             $continue = true;
             $xhome = $posttarget;
         }
     }
     break;
     // plugin post
 // plugin post
 case 7:
     _extend('call', 'posts.' . $pluginflag . '.validate', array('home' => $posttarget, 'valid' => &$continue));
     break;
     // blbost
 // blbost
 default:
     die;
开发者ID:sunlight-cms,项目名称:sunlight-cms-7,代码行数:31,代码来源:post.php

示例15: intval

<?php

/* ---  kontrola jadra  --- */
if (!defined('_core')) {
    exit;
}
/* ---  nacteni promennych  --- */
$continue = false;
if (isset($_GET['cat'])) {
    $cid = intval($_GET['cat']);
    if (DB::result(DB::query("SELECT COUNT(id) FROM `" . _mysql_prefix . "-root` WHERE id=" . $cid . " AND type=2"), 0) != 0) {
        $catdata = DB::query_row("SELECT title,var1,var2 FROM `" . _mysql_prefix . "-root` WHERE id=" . $cid);
        $continue = true;
    }
}
/* ---  vystup --- */
if ($continue) {
    $output .= "\n<p class='bborder'>" . $_lang['admin.content.articles.list.p'] . "</p>\n";
    // nastaveni strankovani podle kategorie
    $artsperpage = $catdata['var2'];
    switch ($catdata['var1']) {
        case 1:
            $artorder = "art.time DESC";
            break;
        case 2:
            $artorder = "art.id DESC";
            break;
        case 3:
            $artorder = "art.title";
            break;
        case 4:
开发者ID:sunlight-cms,项目名称:sunlight-cms-7,代码行数:31,代码来源:content-articles-list.php


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