mysql_query("SELECT * FROM users LEFT JOIN user_landlord_details ON users.ID = user_landlord_details.user_id WHERE users.ID = '".$message['from_user_id']."'")
The third table is called user_student_details and needs to join users.ID ON user_student_details.user_id
mysql_query("
SELECT * FROM users, user_landlord_details, user_student_details
WHERE (users.ID = user_landlord_details.user_id AND users.ID = user_student_details.user_id)
AND users.ID = '".$message['from_user_id']."'");
It depends on if you want to display records from a table only if the join id is found in the other table and that is complicated by having three tables.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
SELECT *
FROM users
LEFT JOIN user_landlord_details
ON users.ID = user_landlord_details.user_id
left join user_student_details
ON user_student_details.user_id=users.id
WHERE users.ID = 123
The join statement worked perfectly. Just one extra thing. I have duplicate names in the tables. How would i implement a AS statement into the SQL. So users.forename AS UserForename.