I have searched for quite a while now about the possibility of having two tables (one for username and one for password) but haven't found anything useful.
I have two tables linked together with Primary Key and Foreign Key. One containing the username and one containing the password.
My current code is only for one table, like this:
$result = mysqli_query($con, "SELECT membersid FROM members
WHERE user='{$_POST['user']}'
AND pass='{$_POST['passwd']}'");
Is there anyway I can use like equi joins together with input in my form?
All I got is this:
$result = mysqli_query($con, "SELECT adminuser.userid, adminpass.passid
FROM adminuser, adminpass
WHERE username='{$_POST['user']}'
AND password='{$_POST['passwd']}'");
I know it's probably completely wrong, and I searched for an answer but haven't found one, that's why I'm turning here for help.
Is there anyway to solve my problem?
I am not sure, but here's my 0.02 cents. You are missing this.
ON adminuser.userid=adminpass.userid;
Or maybe, this is more easy to understand.
INNER JOIN
is used to combine rows from two or more tables, based on a common field between them.
SELECT adminuser.userid, adminpass.passid
FROM adminuser
INNER JOIN adminpass
ON adminuser.userid=adminpass.userid;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.