我制作了一个PHP脚本来升级他/她的防火墙应用程序(我网站的一个功能)。我写了这段代码:
<?php
session_start();
include_once 'dbconnect.php';
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "dbtest";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if(!isset($_SESSION['user']))
{
header("Location: index.php");
}
$query = "UPDATE users SET firewall = firewall + 1, money = money - 300 WHERE user_id=".$_SESSION['user']")";
?>
请帮助我,看看我做错了什么。
答案 0 :(得分:0)
$query = "UPDATE users SET firewall = firewall + 1, money = money - 300 WHERE user_id=".$_SESSION['user'];
$update = mysqli_query($conn,$query);