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


PHP DBAccess::QueryAssoc方法代码示例

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


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

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

示例2: is_authentic

/**
 * Just do a check whether the input username and password is valid
 * @return boolean
**/
function is_authentic($user, $pass)
{
    $filter = new Filter();
    $user = $filter->toUsername($user);
    $pass = $filter->toPassword($pass);
    $res = false;
    if ($user != '' && $pass != '') {
        $sql = new DBAccess();
        $q = "select uname, player_id from players where lower(uname) =\n\t\t\tlower('" . $user . "') and pname = '" . $pass . "' and confirmed = 1 limit 1";
        $results = $sql->QueryAssoc($q);
        $rows = $sql->getRowCount();
        if (1 == $rows) {
            $res = true;
        }
    }
    return $res;
}
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:21,代码来源:lib_auth.php

示例3: render_clan_members

function render_clan_members($clan = null, $limit = 30)
{
    ob_start();
    if ($clan) {
        $where = "where clan = '{$clan}' and confirmed=1";
        $sel = "select uname, player_id, health from players {$where} order by health desc, level desc limit {$limit}";
        $sql = new DBAccess();
        $ninjas = $sql->QueryAssoc($sel);
        ?>
        <div class='clan-members'>
            <div class='subtitle'>Clan members</div>
                <?php 
        if (!empty($ninjas)) {
            $display_ul = true;
        }
        if ($display_ul) {
            echo "<ul>";
        }
        foreach ($ninjas as $ninja) {
            $added_class = '';
            if ($ninja['health'] < 1) {
                $added_class = ' injured';
            }
            echo "<li class='clan-member{$added_class}'>\n                            <a href='player.php?target_id=" . $ninja['player_id'] . "'>\n                                " . $ninja['uname'] . "\n                            </a>\n                          </li>";
        }
        if ($display_ul) {
            echo "</ul>";
        }
        ?>
        </div>
        <?php 
    }
    $res = ob_get_contents();
    ob_end_clean();
    return $res;
}
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:36,代码来源:lib_player.php


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