本文整理汇总了PHP中users::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP users::insert方法的具体用法?PHP users::insert怎么用?PHP users::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类users
的用法示例。
在下文中一共展示了users::insert方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: new_user
public function new_user()
{
$username = $_REQUEST['username'];
$password = $_REQUEST['password'];
$nickname = '';
$user = new users();
if ($user->has($username)) {
echo 1;
return;
}
$suc = $user->insert($username, $password, $nickname);
$_SESSION['uid'] = $user->id;
$_SESSION['uname'] = $user->username;
return $suc ? 0 : 1;
}
示例2: users
<?php
if ($_POST) {
include_once $_SERVER['DOCUMENT_ROOT'] . '/objects/user.php';
$users = new users($db);
$users->username = $_POST['username'];
$users->password = $_POST['password'];
$users->userlevel = $_POST['userlevel'];
$users->isactive = 0;
$users->insert();
header("refresh: 0");
}
?>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h4 class="modal-title" id="myModalLabel">Tambah Data User</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" action="" method="post">
<div class="row">
<div class="form-group">
<label class="col-md-3 control-label" for="username">User Name</label>
<div class="col-md-7">
<input type="text" id="username" name="username" placeholder="Masukan Username/nama pegawai" class="form-control" required>
</div>
</div>
示例3: header
if (!empty($a)) {
echo '$a is !empty';
$valSurname = $a[0];
$valName = $a[1];
$valFname = $a[2];
}
//делаю апдейт
$b = $new->updateById($id);
if ($b == 1) {
header("Location: http://site.dev/class/class.php");
$valSurname = '';
$valName = '';
$valFname = '';
}
//вношу данные
$c = $new->insert();
//удаляю данные
$d = $new->delete($id);
//вытаскиваю всю базу
$all = $new->selectAll();
//Создаю заголовки таблицы и добавляю их в массив таблицы
$head = ['id' => 'ID', 'surname' => 'SURNAME', 'nam' => 'NAME', 'fname' => "FATHER'S NAME", 'bdel' => 'DELETE', 'up' => 'UPDATE'];
array_unshift($all, $head);
//создаю ссылки для апдейта и делита и добавляю их в массив таблицы
for ($t = 1; $t < count($all); $t++) {
$del[$t] = '<a href="http://site.dev/class/class.php?action=delete&id=' . $all[$t]['id'] . '">DELETE</a>';
$up[$t] = '<a href="http://site.dev/class/class.php?action=update&id=' . $all[$t]['id'] . '">UPDATE</a>';
}
for ($m = 1; $m < count($all); $m++) {
$all[$m]['del'] = $del[$m];
$all[$m]['up'] = $up[$m];
示例4: users
echo '</pre>';
echo '<pre>';
print_r($_POST);
echo '</pre>';
$new = new users();
echo 'table name is ' . $new->tableName() . '<br>';
if (isset($_GET['id'])) {
$id = $_GET['id'];
} else {
$id = 0;
}
echo 'id = ' . $id . '<br>';
$sellect = $new->selectForUpdate($id);
$update = $new->updateById($id);
$delete = $new->delete($id);
$insert = $new->insert();
$sellectAll = $new->selectAll();
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Class work</title>
<meta charset="utf-8">
<link rel="stylesheet" href="bootstrap.css">
<script type="text/javascript" scr="bootstrap.js"></script>
</head>
<body>
<h4>Please, enter your data into the form below</h4>
<form action="class.php" method="POST">
Enter your surname: <input type="text" name="surname"><br>