guys php beginner is here :)
i know my question has been asked a lot, but i read more than 20 answers & most of them not working with my query, and my query is simple but i don't know why didn't work with me :(,
i have 2 TABLE :
1- USERS : (id,username,country,status) primary key is id & foregin key is country
2- countries (country_id,country_en,country_code) primary key is country_id
when i insert data into countries table & inserting data into users everything FINE & CONNECTED to each other!
but when i came to query part here 's my problem : everything here is working! but the country output value is ID & i want it to be the name of it because the country_en has name values
$sql = "SELECT * FROM `users`
WHERE `users`.`status` = 'active'
ORDER BY RAND() LIMIT 10 ";
after i read many question's answers i tried to add UNION, LEFT JOIN, etc.. but still the same & i know the problem from my & i will learn from my mistakes final query that i tried to solve this issue
$sql = "SELECT *
FROM `users` WHERE `users`.`status` = 'active'
INNER JOIN `countries` ON `users`.`country` = `countries`.`country_en`
ORDER BY RAND() LIMIT 10 ";
could you guys help me with it :(