[英]How to combine these two credentials Queries?
I wanted to make this two queries into one query. 我想将这两个查询合并为一个查询。 The purpose of the query is to check if the credentials match in either of the table "user_credentials" or "workers". 该查询的目的是检查凭据是否在表“ user_credentials”或“ workers”中匹配。 How can I do so? 我该怎么办?
SELECT user_name FROM user_credentials WHERE user_name = '$user_email' AND password = '$user_password' 从user_credentials中选择user_name,在其中user_name ='$ user_email'和password ='$ user_password'
SELECT user_name FROM workers WHERE user_name = '$user_email' AND password = '$user_password' 从工作人员中选择user_name,在其中user_name ='$ user_email'和password ='$ user_password'
try this 尝试这个
SELECT user_name FROM user_credentials WHERE user_name = '$user_email' AND password = '$user_password'
union
SELECT user_name FROM workers WHERE user_name = '$user_email' AND password = '$user_password'
then check mysqli_num_rows
or mysql_num_rows
然后检查mysqli_num_rows
或mysql_num_rows
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.