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


PHP DBAccess::Insert方法代码示例

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


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

示例1: create_player

function create_player($send_name, $params = array())
{
    $sql = new DBAccess();
    $send_email = $params['send_email'];
    $send_pass = $params['send_pass'];
    $send_class = $params['send_class'];
    $preconfirm = (int) $params['preconfirm'];
    $confirm = (int) $params['confirm'];
    $referred_by = $params['referred_by'];
    $headers = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "From: " . SYSTEM_MESSENGER_NAME . " <" . SYSTEM_MESSENGER_EMAIL . ">\r\n";
    $headers .= "Reply-To: " . SUPPORT_EMAIL_FORMAL_NAME . " <" . SUPPORT_EMAIL . ">\r\n";
    // Create the initial player row.
    $playerCreationQuery = "INSERT INTO players\n\t\t (uname, pname, health, strength, gold, messages, kills, turns, confirm, confirmed,\n\t\t  email, class, level,  status, member, days, ip, bounty, clan, clan_long_name, created_date)\n\t\t VALUES\n\t\t ('{$send_name}','{$send_pass}','150','5','100','','0','180','{$confirm}','{$preconfirm}',\n\t\t '{$send_email}','{$send_class}','1','1','0','0','','0','','', now())";
    //  ***  Inserts the choices and defaults into the player table. Status defaults to stealthed. ***
    $sql->Insert($playerCreationQuery);
    //  ***  Sends out the confirmation email to the chosen email address.  ***
    $_to = "{$send_email}";
    $_subject = "NinjaWars Account Sign Up";
    $_body = render_template('signup_email_body.tpl', array('send_name' => $send_name, 'confirm' => $confirm, 'send_class' => $send_class, 'WEB_ROOT' => WEB_ROOT, 'SUPPORT_EMAIL' => SUPPORT_EMAIL));
    $_from = "{$headers}";
    // *** Create message object.
    $message = new Nmail($_to, $_subject, $_body, $_from);
    if (DEBUG) {
        $message->dump = true;
    }
    $sent = false;
    // By default, assume failure.
    $sent = $message->send();
    // TODO: Need an in-game error logging.
    return $sent;
}
开发者ID:ninjajerry,项目名称:ninjawars,代码行数:33,代码来源:lib_player.php


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