I have two tables - the first one is called \'users\' and the second one is called \'buy_courses\'.
I am trying to select all users those user_name
You can use SQL's 'NOT IN'.
Example:
mysqli_query($con, "SELECT * FROM users WHERE user_name NOT IN (SELECT user_name FROM buy_courses)");