After clicking login on the login page, the data cannot be queried and the login cannot be successful, but the query operation in the database can be successful. What is the reason?
移动用户-2386203
移动用户-2386203 2021-03-07 17:16:01
0
1
1400

session_start();

error_reporting(E_ERROR);

$zh=$_POST['zh'];

$password=$_POST['password'];

$user=$_POST['user'];

if(!isset($user)){

echo "";

echo "";

}

$conn=mysqli_connect("localhost","8admin","8admin")or die('连接数据库失败');

$db=mysqli_select_db($conn,"8_com");

$sql1="SELECT*FROM admin WHERE admin_id ='$zh' AND password='$password' ";

$sql2="select * from teacher where teach_id ='$zh' and password='$password' ";

$sql3="select * from student where stuno ='$zh' and password='$password' ";

mysqli_query($conn,"set names utf8");

switch($user){

case 1:$result=mysqli_query($conn,$sql)or die('查询不到');

$row = mysqli_fetch_array($conn,$result);

$count=$row[0];

if($count!=""){

$url="index_admin.php";

$_SESSION['admin_name']=$row['name'];

$_SESSION['admin_id']=$row['admin_id'];

echo "";

}

else {

echo "";

echo "";

}

break;

case 2:$result=mysqli_query($sql2,$conn);

$result=mysqli_query($sql2,$conn)or die('查询不到');

$row = mysqli_fetch_array($result);

$count=$row[0];

if($count!=""){

$url="index_teacher.php";

$_SESSION['teacher_name']=$row['name'];

$_SESSION['teacher_id']=$row['teach_id'];

echo "";

}

else {

echo "";

echo "";

}

break;

case 3:$result=mysqli_query($sql3,$conn);

$result=mysqli_query($sql3,$conn)or die('查询不到');

$row = mysqli_fetch_array($result);

$count=$row[0];

if($count!=""){

$url="index_stu.php";

$_SESSION['stu_name']=$row['name'];

$_SESSION['stu_id']=$row['stuno'];

echo "";

}

else {

echo "";

echo "";

}

break;

default :break;

}

mysqli_close($conn);

?>

移动用户-2386203
移动用户-2386203

reply all (1)
灭绝师太

Whether the data can be obtained by back-end breakpoint printing

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!