We have above two tables in our database named Account and Count. What we need is to compare username & password from account table so that user can login & then need to get his respective user_id from count table.
Account table contains id, username and password .
Count table contains user_id and point.
Account:
ID | username | password | email
--------------------------------------------
1 | sample1 | *** | abc@gmail.com
Count:
user_id | friends | point
---------------------------------
1 | 99 | 80
Now the problem is we need the above solution with our current code below .....
LOGIN -----------------
Code: Select all
if($formAction == "login") {
//VERIFY IF THE USERNAME ALREADY EXIST
$SQL = "SELECT * FROM Accounts WHERE username = '" . $username . "'";
//GIVE THE RESULT
$result_id = @mysql_query($SQL) or die("DATABASE ERROR!");
$total = mysql_num_rows($result_id);
if($total) {
$datas = @mysql_fetch_array($result_id);
if(!strcmp($password, $datas["password"])) {
if($emailActivation == "true") {
click on his activation link
if($datas["activated"] == 1) {
echo "IMCONNECTED";
}
else {
echo "ACCOUNT_NOT_ACTIVATED";
}
}
else if($emailActivation == "false") {
echo "IMCONNECTED";
}
}
else {
echo "WRONG_PASSWORD";
}
}
else {
echo "User not found!";
}
} //END OF LOGIN ACTION
The code on my post allow me to access all the details about the user after login such as email from the Accounts table, but what i want is to pass a query for 'count' table in such a way so that i can access information about that particular user id such a 'friends' or 'point' from count table.