gpt4 book ai didi

php - 从三个表中检查电子邮件是否存在

转载 作者:行者123 更新时间:2023-11-29 07:35:12 25 4
gpt4 key购买 nike

<分区>

我有 3 个用户表;一个给学生,一个给教授,另一个给经理。

现在我在 Android 中创建了 3 个不同的布局页面。每个人在 MySQL DB 中都有不同的表。

我想为所有三个登录页面使用一个登录页面,但我不知道该怎么做。我写了一些代码,但我不知道查询是否正确。

<?php

if($_SERVER['REQUEST_METHOD']=='POST'){
include 'db.php';

$con = mysqli_connect($HostName,$HostUser,$HostPass,$DatabaseName);

$email = $_POST['email'];
$password = $_POST['password'];

$Sql_Query = "select exists(
select 1 from manger where Email = '$Email' and Password = '$Password'
union
select 1 from student where Email = '$Email' and Password = '$Password'
union
select 1 from professor where Email = '$Email' and Password = '$Password'
)";

$check = mysqli_fetch_array(mysqli_query($con,$Sql_Query));

if(isset($check)){
echo "Welcome To Application";
}
else{
echo "Invalid Username or Password";
}

}else{
echo "Try Again";
}
mysqli_close($con);

?>

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com