我正在使用phpmyadmin和MySql进行项目。这是注册页面的php文件。
<?php
include 'dbh.php';
$username = $_POST['username'];
$email = $_POST['email'];
$pass = $_POST['pass'];
$inst_id = $_POST['inst_id'];
$sql = "INSERT INTO register ( 'username', 'email', 'pass', 'inst_name' ) VALUES('$username','$email','$pass','$inst_id')";
$result = mysqli_query($conn,$sql);
header("Location: index.html");
?>
我没有收到任何错误,但数据没有插入表中。当我尝试手动将数据输入表格然后登录时,它可以正常工作。这是登录页面的代码
<?php
include 'dbh.php';
$email= $_POST['email'];
$pass = $_POST['pass'];
$sql = "SELECT * FROM register WHERE email='$email' AND pass='$pass'";
$result = mysqli_query($conn,$sql);
if (!$row = mysqli_fetch_assoc($result)){
echo "INCORRECT!";
}
else{
//$session_id['id']=$row['id'];
echo "YAYYY";
}
//header("Location: index.html");
请帮忙! 在此先感谢!!