本文整理汇总了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;
}