Yes, you woudl be using Joins, which are a bit abstract at first. But basically depending on the join you use, joins bring information from another table that match part of your query. for that reason they have to be somewhat premeditatedly structured.
so lets take a look at what you need to do.
first, lets normalize your tables, since your memeberskills table uses memberloginname at a key, it's best to generate an idea for the member name and have it so you only need to change 1 row on 1 table to change the membername should you need to .
so now your tables are:
members:
member_id | loginName | first name | last name
skills:
skill_id | name
member_skills:
member_id | skill _id
( although not seemly neccessary, but probably a good idea to have unique id's on this table too)
Anyway, with that said, lets take a look at our sql in procedural form.
we musts:
1st, get the ID for that user name from the members table
2nd get the matching skill id's for the member_id from the member_skills table
3rd get the skill name for each ID matched in the 2nd part
so our sql would look like so:
$SQL="SELECT `T1`.`first_name`, `T1`.`last_name`,`T3`.`name` AS `skill`
FROM `members` AS `T1`
LEFT JOIN `member_skills` AS `T2` ON `T1`.`member_id` = `T2`.`member_id`
LEFT JOIN `skills` AS `T3` ON `T2`.`skill_id` = `T3`.`skill_id`
WHERE `T1`.`loginName` = '".$MyVariable."'";
so lets take a look at what we did:
SELECT `T1`.`first_name`, `T1`.`last_name`,`T3`.`name` AS `skill`
here we state what items we want to extract from our sql, the t1,t2,t3 are shorter references to the tables we will be using, so you dont have to spell them out every single time, AS basically renames the field you are extracting from the sql
FROM `members` AS `T1`
here is where our table hierchy starts to show, our original inquery is to the members table, being shorthanded to t1, this is the table we will use for our loginname comparison
LEFT JOIN `member_skills` AS `T2` ON `T1`.`member_id` = `T2`.`member_id`
next we get the skill id we need to match from the member_skills table,
Left join will make sure we get only corresponding rows from the members table
LEFT JOIN `skills` AS `T3` ON `T2`.`skill_id` = `T3`.`skill_id`
then we use the id's we got from table 2 to match the names from the skills table as t3
WHERE `T1`.`loginName` = '".$MyVariable."'";
lastly, our loginName comparison
hope this helps