Easiest thing would be just do two seperate queries. I'm thinking something like this
$skilltypes = array("CODING", "HARDWARE");
foreach($skilltypes as $type) {
$sql = "SELECT tc.NAME
FROM table_skills ts, tc.table_credentials
WHERE ts.ID = tc.XREF
AND ts.SKILLTYPE = '".$type."'";
$res = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($res) > 0) {
echo "<ul>\n";
while($row=mysql_fetch_array($res)) {
echo "<li>".$row['NAME']."</li>\n";
}
echo "</ul><br />\n";
}
}
Of course, if you end up doing so many queries that this effects page loading times, you'll want to look at doing it all in one query. At that point, I'd set a sort of "place holder" for the skill type, and do a check within the while loop to see if the place holder == the current skill type. If it doesn't, close the current list, and start a new one.