• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP DBAccess类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getUserInfo

 public function getUserInfo()
 {
     $query = "SELECT * FROM usernames WHERE username = '" . $_POST['username'] . "' AND Password = '" . $_POST['password'] . "'";
     $dbAccess = new DBAccess();
     $select = $dbAccess->select($query);
     return $select;
 }
开发者ID:KacosPro,项目名称:adm-buses,代码行数:7,代码来源:users.php


示例2: render_chat_messages

/**
 * Render the div full of chat messages.
 * @param $chatlength Essentially the limit on the number of messages.
**/
function render_chat_messages($chatlength, $show_elipsis = null)
{
    // Eventually there might be a reason to abstract out get_chats();
    $sql = new DBAccess();
    $sql->Query("SELECT sender_id, uname, message, age(now(), date) as ago FROM chat join players on chat.sender_id = player_id ORDER BY chat_id DESC LIMIT {$chatlength}");
    // Pull messages
    $chats = $sql->fetchAll();
    $message_rows = '';
    $messageCount = $sql->QueryItem("select count(*) from chat");
    if (!isset($show_elipsis) && $messageCount > $chatlength) {
        $show_elipsis = true;
    }
    $res = "<div class='chatMessages'>";
    $previous_date = null;
    $skip_interval = 3;
    // minutes
    foreach ($chats as $messageData) {
        $l_ago = time_ago($messageData['ago'], $previous_date);
        $message_rows .= "<li>&lt;<a href='player.php?player_id={$messageData['sender_id']}'\n\t\t     target='main'>{$messageData['uname']}</a>&gt; " . out($messageData['message']) . " <span class='chat-time'>{$l_ago}</span></li>";
        $previous_date = $messageData['ago'];
        // Store just prior date.
    }
    $res .= $message_rows;
    if ($show_elipsis) {
        // to indicate there are more chats available
        $res .= ".<br>.<br>.<br>";
    }
    $res .= "</div>";
    return $res;
}
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:34,代码来源:lib_chat.php


示例3: getDestinationCities

 public function getDestinationCities()
 {
     $destinationCities = array();
     $query = 'SELECT DISTINCT destino FROM rutas';
     $dbAccess = new DBAccess();
     $select = $dbAccess->select($query);
     return $select;
 }
开发者ID:KacosPro,项目名称:adm-buses,代码行数:8,代码来源:routes.php


示例4: getUserfullname

 public function getUserfullname($username, $password)
 {
     session_start();
     $query = "SELECT * FROM usernames WHERE username = '" . $username . "' AND Password = '" . $password . "'";
     $dbAccess = new DBAccess();
     $select = $dbAccess->select($query);
     return $select;
 }
开发者ID:KacosPro,项目名称:adm-buses,代码行数:8,代码来源:user-fullname.php


示例5: update_last_attack_time

/**
 * Attack function library.
 * @package combat
 * @subpackage lib_attack
**/
function update_last_attack_time($player_id, $sql = null)
{
    if (!$sql) {
        $sql = new DBAccess();
    }
    $update_last_attacked = "update players set last_started_attack=now() where player_id='" . intval($player_id) . "'";
    $sql->Query($update_last_attacked);
    // updates the timestamp of the last_attacked column to slow excessive attacks.
}
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:14,代码来源:lib_attack.php


示例6: check_for_resurrection

function check_for_resurrection($echo = FALSE)
{
    $dbObj = new DBAccess();
    $dbObj->Update("UPDATE players\n                    SET status = 0,\n                    health = (CASE WHEN class='White' THEN (150+(level*3)) ELSE 100 END)\n                    WHERE confirmed = 1\n                    AND health < 0\n                    AND resurrection_time = (SELECT amount from time where time_label='hours')\n                    AND\n                    ( days<31 OR\n        \t\t\t\t(\n        \t\t\t\t\t((days %\n        \t\t\t\t\t    cast(floor(days / 10) AS integer))\n        \t\t\t\t\t    =0\n        \t\t\t\t\t)\n        \t\t\t\t)\n        \t\t\t)\n                  ");
    // *** Resurrect and heal all players at this countdown spot.
    if ($echo) {
        $healedPlayers = $dbObj->a_rows;
        echo "Number of healed/resurrected players: " . $healedPlayers;
    }
}
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:10,代码来源:check_for_resurrection.php


示例7: __construct

 public function __construct($player_id_or_username)
 {
     $sql = new DBAccess();
     if (!is_numeric($player_id_or_username)) {
         $sel = "select player_id from players where uname = '" . $player_id_or_username . "' limit 1";
         $this->player_id = $sql->QueryItem($sel);
     } else {
         $this->player_id = $player_id_or_username;
     }
     $dao = new PlayerDAO($sql);
     $this->vo = $dao->get($this->player_id);
 }
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:12,代码来源:Player.class.php


示例8: render_active

function render_active($limit = 5, $alive_only = true)
{
    $where_cond = $alive_only ? 'and health>0' : '';
    $sel = "select uname, player_id from players where confirmed=1 {$where_cond} order by last_started_attack desc limit {$limit}";
    $sql = new DBAccess();
    $res = $sql->QueryAssoc($sel);
    $out = "\n    <div class='active-players'>\n      <ul>\n        <li><span>Lurking ninja: </span></li>\n\t";
    foreach ($res as $ninja) {
        $out .= "        <li class='active-ninja'><a href='player.php?target_id=" . $ninja['player_id'] . "'>" . $ninja['uname'] . "</a></li>";
    }
    $out .= "\n      </ul>\n    </div>\n    ";
    return $out;
}
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:13,代码来源:lib_player_list.php


示例9: clan_size

/**
 * This determines how the clans get ranked and tagged, and how to only show non-empty clans.
**/
function clan_size()
{
    $res = array();
    $db = new DBAccess();
    $sel = "select sum(level-3-round(days/5)) as sum, clan_long_name from players where confirmed = 1 group by clan_long_name order by sum desc";
    $counts = $db->FetchAll($sel);
    $largest = reset($counts);
    $max = $largest['sum'];
    foreach ($counts as $clan_info) {
        // make percentage of highest, multiply by 10 and round to give a 1-10 size
        $res[$clan_info['clan_long_name']] = floor(($clan_info['sum'] - 1 < 1 ? 0 : $clan_info['sum'] - 1) / $max * 10) + 1;
    }
    return $res;
}
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:17,代码来源:lib_tags.php


示例10: json_index

function json_index()
{
    $sql = new DBAccess();
    $player = get_player_info();
    $events = array();
    $messages = array();
    $user_id = $player['player_id'];
    if ($user_id) {
        $events = $sql->FetchAll("select event_id, message as event, date, send_to, send_from, unread, uname as sender from events join players on player_id = send_from where send_to = '" . sql($user_id) . "' order by date desc limit 1");
        //$chats = $sql->FetchAll("select * from chat order by time desc");
        $messages = $sql->FetchAll("select message_id, message, date, send_to, send_from, unread, uname as sender from messages join players on player_id = send_from where send_to = '" . sql($user_id) . "' and send_from != '" . sql($user_id) . "' order by date desc limit 1");
    }
    return '{"player":' . json_encode($player) . ',"message":' . json_encode(reset($messages)) . ',"event":' . json_encode(reset($events)) . '}';
}
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:14,代码来源:api.php


示例11: display

    function display($tpl = null)
    {
        global $mainframe, $option;
        $mainframe = JFactory::getApplication();
        $db = JFactory::getDBO();
        $search = $mainframe->getUserStateFromRequest("{$option}.search", 'search', '', 'string');
        if (strpos($search, '"') !== false) {
            $search = str_replace(array('=', '<'), '', $search);
        }
        $search = JString::strtolower($search);
        $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
        $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
        //	echo $limitstart;
        //	echo $limit;
        $where = array();
        if ($search) {
            $where[] = 'LOWER(pn_poly_name) LIKE ' . $db->Quote('%' . $db->getEscaped($search, true) . '%', false);
        }
        $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
        //	if($limiter || $limit) {
        $limiter = ' LIMIT ' . $limitstart . ', ' . $limit;
        //	}
        $mysqli = DBAccess::getConnection();
        $query = 'SELECT * from pn_lenses_polymers';
        $result = $mysqli->selectQuery($query);
        $total = $result->num_rows;
        //	echo $total;
        jimport('joomla.html.pagination');
        $pagination = new JPagination($total, $limitstart, $limit);
        //$mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
        $query = 'SELECT * from pn_lenses_polymers ' . $where . ' ORDER BY pn_poly_name' . $limiter;
        $result = $mysqli->selectQuery($query);
        while ($obj = $result->fetch_object()) {
            $polymers[] = $obj;
        }
        foreach ($polymers as $poly) {
            switch ($poly->pn_fda_grp) {
                case 1:
                    $poly->pn_fda_grp = 'Low Water (<50 percent water content), Nonionic Polymers.<br />This group has the greatest resistance to protein deposition due
to its lower water content and nonionic nature. Heat, chemical, and hydrogen peroxide care regimens can be used.';
                    break;
                case 2:
                    $poly->pn_fda_grp = 'High Water (greater than 50 percent water content), Nonionic Polymers.<br />The higher water content of this group results in g
reater protein attraction than with group 1. However, the nonionic polymers reduce the potential for further attraction. Heat disinfection should be a
voided because of the high water content. In addition, sorbic acid and potassium sorbate preservatives can discolor the lenses.';
                    break;
                case 3:
                    $poly->pn_fda_grp = 'Low Water (less then 50 percent water content), Ionic Polymers.<br />The lower water content but ionic nature of these polymers
 results in intermediate protein resistance. Heat, chemical and hydrogen peroxide care systems may be used.';
                    break;
                case 4:
                    $poly->pn_fda_grp = 'High Water (greater then 50 percent water content), Ionic Polymers.<br />Because of the high water content and ionic nature of
these polymers they attract more proteins than any other group. It is best to avoid heat disinfection and sorbic acid preservatives.';
                    break;
            }
        }
        $this->assignRef('polymers', $polymers);
        $this->assignRef('pagination', $pagination);
        parent::display($tpl);
    }
开发者ID:grlf,项目名称:eyedock,代码行数:60,代码来源:view.html.php


示例12: getConnection

 public static function getConnection()
 {
     if (is_null(self::$_dbinstance)) {
         self::$_dbinstance = new DBAccess();
     }
     return self::$_dbinstance;
 }
开发者ID:grlf,项目名称:eyedock,代码行数:7,代码来源:mysqliSingleton.php


示例13: getDbAccessor

 private static function getDbAccessor()
 {
     if (self::$_dbAccessor == null) {
         self::$_dbAccessor = new DBAccessor();
     }
     return self::$_dbAccessor;
 }
开发者ID:vin100zz,项目名称:mesautos,代码行数:7,代码来源:db.php


示例14: delete_mail

/**
 * Delete an array of ids or all mail for a certain user.
**/
function delete_mail($ids, $all = false)
{
    $sql = new DBAccess();
    $deleted = 0;
    $username = get_username();
    if ($all) {
        // Delete all a user's mail.
        $del = "DELETE from mail where send_to='" . $username . "'";
    } else {
        // Delete an id list.
        $del = "DELETE from mail where send_to='" . $username . "'\n            AND id in ('" . implode("', '", $ids) . "')";
    }
    $sql->Delete($del);
    $deleted = $sql->a_rows;
    return $deleted;
}
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:19,代码来源:lib_mail.php


示例15: get_player_info

/**
 * Returns the state of the player from the database,
 * uses a user_id if one is present, otherwise
 * defaults to the currently logged in player, but can act on any player
 * if another username is passed in.
 * @param $user user_id or username
 * @param @password Unless true, wipe the password.
**/
function get_player_info($user = null, $password = false)
{
    $sql = new DBAccess();
    $player_data = null;
    if (is_numeric($user)) {
        $sel_player = "select * from players where player_id = '" . $user . "' limit 1";
    } else {
        $username = either($user, SESSION::is_set('username') ? SESSION::get('username') : null);
        // Default to current session user.
        $sel_player = "select * from players where uname = '" . sql($username) . "' limit 1";
    }
    $player_data = $sql->QueryRowAssoc($sel_player);
    if (!$password) {
        unset($player_data['pname']);
    }
    return $player_data;
}
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:25,代码来源:lib_header.php


示例16: test_player_obj

function test_player_obj()
{
    // in: player_id, out: valid db save
    $player_id_sel = "select player_id from players where uname = 'glassbox'";
    $db = new DBAccess();
    $player_id = $db->QueryItem($player_id_sel);
    $player = new Player($player_id);
    assert($player->vo->player_id == $player_id);
    $orig_clan = $player->vo->clan_long_name;
    $player->vo->clan_long_name = 'Testingz';
    $player->save();
    $changed_player = new Player($player_id);
    $changed_clan = $changed_player->vo->clan_long_name;
    $changed_player->vo->clan_long_name = $orig_clan;
    assert($changed_clan == 'Testingz');
    // in: player uname, out: valid db save
    $player = new Player('glassbox');
    assert($player->vo->player_id == $player_id);
    $orig_clan = $player->vo->clan_long_name;
    $player->vo->clan_long_name = 'Testingz';
    $player->save();
    $changed_player = new Player($player_id);
    $changed_clan = $changed_player->vo->clan_long_name;
    $changed_player->vo->clan_long_name = $orig_clan;
    assert($changed_clan == 'Testingz');
    // in: player status check, out: no errors
    $player = new Player('glassbox');
    assert($player->vo->player_id == $player_id);
    $orig_clan = $player->vo->clan_long_name;
    $player->vo->clan_long_name = 'Testingz';
    $player->save();
    $changed_player = new Player($player_id);
    $changed_clan = $changed_player->vo->clan_long_name;
    $changed_player->vo->clan_long_name = $orig_clan;
    assert($changed_clan == 'Testingz');
    // in: player, out: vo of player data
    $player = new Player('glassbox');
    $vo = $player->as_vo();
    assert($vo instanceof PlayerVO);
    // in: player, out: array of player data
    $player = new Player('glassbox');
    $arr = $player->as_array();
    assert(count($arr) > 0);
    var_dump($arr);
}
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:45,代码来源:lib_char_tests.php


示例17: FindAll

 static function FindAll($wh = null, $arrFields = "*", $sort = array(), $sortBy = "A", $lStart = 0, $numRecs = 0, $status = array(_ACTIVE))
 {
     $result = DBAccess::querySelect(self::$_tablename, $wh, $arrFields, $sort, $sortBy, $lStart, $numRecs, $status);
     $arr = array();
     while ($row = $result->fetch_object()) {
         $arr[] = new Category($row->catid, $row->catname, $row->catlink, $row->status);
     }
     return $arr;
 }
开发者ID:hderanga,项目名称:snaptag,代码行数:9,代码来源:category.class.php


示例18: render_clan_join

function render_clan_join($process = null, $username, $clan_name)
{
    $sql = new DBAccess();
    if ($process == 1) {
        $confirm = $sql->QueryItem("SELECT confirm FROM players WHERE uname = '{$username}'");
        $url = message_url("clan_confirm.php?clan_joiner=" . rawurlencode($username) . "&confirm={$confirm}&clan_name=" . rawurlencode($clan_name), 'Confirm Request');
        $join_request_message = "CLAN JOIN REQUEST: {$username} has sent you a clan request.\n            If you wish to allow this ninja into your clan click the following link:\n            {$url}";
        send_message(get_user_id($username), get_user_id($clan_name), $join_request_message);
        echo "<div>***Your request to join this clan has been sent to {$clan_name}***</div>\n";
    } else {
        //Clan Join list of available Clans
        $clan_leaders = $sql->FetchAll("SELECT uname,level,clan,clan_long_name FROM players\n            WHERE lower(uname) = lower(clan) AND clan_long_name != '' AND confirmed = 1");
        echo "<p>Clans Available to Join</p>\n        <p>To send a clan request click on that clan leader's name.</p>\n        <ul>";
        foreach ($clan_leaders as $leader) {
            echo "<li><a href=\"clan.php?command=join&clan_name={$leader['clan']}&process=1\">\n                    Join {$leader['clan_long_name']}</a>.\n                    Its leader is <a href=\"player.php?player=" . rawurlencode($leader['uname']) . "\">\n                    {$leader['uname']}</a>, level {$leader['level']}.\n                    <a href=\"clan.php?command=view&clan_name={$leader['clan']}\">View This Clan</a>\n                </li>\n";
        }
        echo "</ul>";
    }
}
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:19,代码来源:lib_clan.php


示例19: deletePolymer

 function deletePolymer($id)
 {
     $mysqli = DBAccess::getConnection();
     //$mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
     $query = 'DELETE from pn_lenses_polymers where pn_poly_tid = ' . $id;
     echo $query;
     if ($result = $mysqli->selectQuery($query)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:grlf,项目名称:eyedock,代码行数:12,代码来源:pnpolymers.php


示例20: display

 function display($tpl = null)
 {
     global $mainframe, $option;
     $mainframe = JFactory::getApplication();
     $db = JFactory::getDBO();
     $search = $mainframe->getUserStateFromRequest("{$option}.search", 'search', '', 'string');
     if (strpos($search, '"') !== false) {
         $search = str_replace(array('=', '<'), '', $search);
     }
     $search = JString::strtolower($search);
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
     //	echo $limitstart;
     //	echo $limit;
     $where = array();
     if ($search) {
         //echo $search;
         $where[] = 'LOWER(name) LIKE ' . $db->Quote('%' . $db->getEscaped($search, true) . '%', false);
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     //	if($limiter || $limit) {
     $limiter = ' LIMIT ' . $limitstart . ', ' . $limit;
     //	}
     $mysqli = DBAccess::getConnection();
     $query = 'SELECT * from pn_lenses_companies';
     $result = $mysqli->selectQuery($query);
     $total = $result->num_rows;
     //	echo $total;
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit);
     //$mysqli = getSQLI();
     $query = 'SELECT * from pn_lenses_companies ' . $where . ' ORDER BY pn_comp_name' . $limiter;
     //echo $query;
     $result = $mysqli->selectQuery($query);
     if ($result) {
         while ($obj = $result->fetch_object()) {
             $companies[] = $obj;
         }
     }
     $this->assignRef('search', $search);
     $this->assignRef('companies', $companies);
     $this->assignRef('pagination', $pagination);
     $this->addToolBar();
     parent::display($tpl);
 }
开发者ID:irovast,项目名称:eyedock,代码行数:45,代码来源:view.html.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP DBAdapter类代码示例发布时间:2022-05-23
下一篇:
PHP DB类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap