本文整理汇总了PHP中MySQL::set方法的典型用法代码示例。如果您正苦于以下问题:PHP MySQL::set方法的具体用法?PHP MySQL::set怎么用?PHP MySQL::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MySQL
的用法示例。
在下文中一共展示了MySQL::set方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redirect
$info = $db->from("User")->where("`id`='" . $_SESSION['id'] . "'")->select()->fetch_one();
if ($info['pass'] != $_POST['old_pass']) {
redirect("error.php");
}
$para = array('nick' => $_POST['nick'], 'school' => $_POST['school']);
if ($info['power'] == 2) {
$para['use'] = 'no';
}
$hook = false;
if (isset($_POST['new_pass'])) {
if ($_POST['new_pass'] != "") {
$para['pass'] = $_POST['new_pass'];
$hook = true;
}
}
$db->set($para)->where("`id`='" . $_SESSION['id'] . "'")->update("User");
if ($hook) {
$qu = $db->from("User")->where("`id`='" . $_SESSION['id'] . "'")->select()->fetch_one();
$_SESSION['uu'] = $qu['user'];
$_SESSION['pp'] = $qu['pass'];
$_SESSION['new_pass'] = $_POST['new_pass'];
redirect('hook.php?action=modifyUser');
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Index</title>
<script>
示例2: redirect
Filename: modify.php
Description: Created by SpringHack using vim automatically.
**/
require_once "user.common.php";
require_once "tech.common.php";
if (!isset($_SESSION['id'])) {
redirect("login.php");
}
if ($db->from("User")->where("`id`='" . $_SESSION['id'] . "'")->select()->fetch_one()['use'] != 'yes') {
redirect("none.php");
}
$db = new MySQL();
switch ($_GET['action']) {
case 'check':
if ($db->from("Tech")->where("`user`='" . $_SESSION['id'] . "' AND `id`='" . $_GET['id'] . "'")->select()->num_rows() == 1) {
$db->set(array('hack' => 'check', 'reason' => ''))->where("`id`='" . $_GET['id'] . "'")->update("Tech");
}
break;
case 'remod':
$db->set(array('hack' => 'remod', 'reason' => $_GET['str']))->where("`id`='" . $_GET['id'] . "'")->update("Tech");
break;
case 'post':
$db->set(array('hack' => 'post', 'reason' => ''))->where("`id`='" . $_GET['id'] . "'")->update("Tech");
break;
case 'recheck':
$db->set(array('hack' => 'recheck', 'reason' => $_GET['str']))->where("`id`='" . $_GET['id'] . "'")->update("Tech");
break;
case 'ok':
$db->set(array('hack' => 'ok', 'reason' => ''))->where("`id`='" . $_GET['id'] . "'")->update("Tech");
default:
break;
示例3: redirect
redirect('error.php');
} else {
$id = 'old';
}
} else {
$id = 'new';
}
$_POST['time'] = time();
$_POST['work'] = serialize($_POST['work']);
if ($id == 'new') {
unset($_POST['submit']);
$db->value($_POST)->insert('Expert');
echo $db->error();
} else {
unset($_POST['submit']);
$db->set($_POST)->where("`user_id`='" . $_POST['user_id'] . "' AND `user_pw`='" . $_POST['user_pw'] . "'")->update('Expert');
}
redirect('expert.php?user_id=' . $_POST['user_id']);
}
$addition = '';
if (isset($_GET['user_id'])) {
$addition = '
<script>
$(function () {
$.get("json.php?time=" + (new Date()).getTime() + "&action=getExpert&user_id=' . $_GET['user_id'] . '", function (data) {
data = JSON.parse(data);
for (var i in data)
{
switch (i)
{
case "work":
示例4: redirect
<?php
/**
Author: SpringHack - springhack@live.cn
Last modified: 2015-11-03 17:52:54
Filename: uuu.php
Description: Created by SpringHack using vim automatically.
**/
?>
<?php
require_once "user.common.php";
require_once "tech.common.php";
if (!isset($_SESSION['id'])) {
redirect("login.php");
}
if ($db->from("User")->where("`id`='" . $_SESSION['id'] . "'")->select()->fetch_one()['use'] != 'yes') {
redirect("error.php");
}
$db = new MySQL();
if ($_GET['action'] == 'yes') {
$db->set(array('use' => 'yes'))->where("`id`='" . $_GET['id'] . "'")->update("User");
} else {
$db->from("User")->where("`id`='" . $_GET['id'] . "'")->delete();
}
?>
<script>
alert("操作成功完成!");
history.back(-1);
</script>
示例5: uniqid
$id = uniqid();
$_POST['user'] = $_SESSION['id'];
$_POST['owner'] = $db->from("User")->where("`id`='" . $_SESSION['id'] . "'")->select()->fetch_one()['nick'];
$_POST['number'] = $id;
$_POST['id'] = $id;
$_POST['keyword'] = serialize($_POST['keyword']);
unset($_POST['submit']);
$db->value($_POST)->insert('Tech');
} else {
$_POST['user'] = $_SESSION['id'];
$_POST['owner'] = $db->from("User")->where("`id`='" . $_SESSION['id'] . "'")->select()->fetch_one()['nick'];
$_POST['number'] = $id;
$_POST['id'] = $id;
$_POST['keyword'] = serialize($_POST['keyword']);
unset($_POST['submit']);
$db->set($_POST)->where("`id`='" . $id . "'")->update('Tech');
}
header('Location: insert.php?id=' . $id);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>新建成果</title>
</head>
<body>
<center>
<?php
require_once "frame.php";
?>