PHP注册不工作-mysqli->;查询
调用成员函数query()表示您试图使用一个名为query的函数,该函数不作为php或用户定义函数存在 变量$query周围不应该有()。用于调用函数的 只需使用$query=“您的sql查询” 您不应该依赖用户输入。在使用$\u POST变量之前,您已经为它们创建了新的变量,这是很好的,但您应该为将它们发送到数据库做好准备PHP注册不工作-mysqli->;查询,php,mysqli,dreamweaver,Php,Mysqli,Dreamweaver,调用成员函数query()表示您试图使用一个名为query的函数,该函数不作为php或用户定义函数存在 变量$query周围不应该有()。用于调用函数的 只需使用$query=“您的sql查询” 您不应该依赖用户输入。在使用$\u POST变量之前,您已经为它们创建了新的变量,这是很好的,但您应该为将它们发送到数据库做好准备 请注意SQL注入。请发布您的connect.php。删除密码和个人数据。连接到数据库并创建$mysqli的构造函数因未知原因失败。请在访问stackoverflow.com
请注意SQL注入。请发布您的
connect.php
。删除密码和个人数据。连接到数据库并创建$mysqli
的构造函数因未知原因失败。请在访问stackoverflow.com之前完成一些基本教程
<?php
include('connect.php');
if (isset($_POST['username']) && isset($_POST['password'])){
$username = $_POST['username'];
$email = $_POST['email'];
$password = $_POST['password'];
global $mysqli;
$query = ("INSERT INTO lr (username, password, email) VALUES ('$username', '$password', '$email')");
$result = $mysqli->query($query, $connection) or die(mysql_erorr());
if($result === true){
$msg = "User Created Successfully.";
}
}
?>
<form id="RegisterUserForm" action="" method="post" enctype="multipart/form-data">
<fieldset>
<p>
<label for="name">Name</label>
<input id="name" name="name" type="text" class="text" value="" />
</p>
<p>
<label for="tel">Email</label>
<input id="email" name="email" type="email" value="" />
</p>
<p>
<label for="Username">Username</label>
<input id="username" name="username" type="username" value="" />
</p>
<p>
<label for="email">Password</label>
<input id="password" type="password" name="password" class="text" value="" />
</p>
<p>
<label for="Cpassword">Confirm Password</label>
<input id="Cpassword" name="Cpassword" class="text" type="password" />
</p>
<p>
<label for="acceptTerms">
I agree to the <a href="">Terms and Conditions</a> and <a href="">Privacy Policy</a><br/>
<input id="acceptTerms" name="acceptTerms" type="checkbox" />
</label>
</p>
<p>
Upload a picture of your student ID. This is for your own safety from fraud attempts
<input type="file" name="fileToUpload" id="fileToUpload" style="color:green">
<input type="submit" value="Upload Image" name="submit" style="color:green">
<br/><br/><br/>
</p>
<input type="submit" id="registerNew" value="Register" />
</fieldset>
ad
</form>
$query = "INSERT INTO lr (username, password, email) VALUES ('$username', '$password', '$email')";