OK...i think i got it here. the trick to this is that you were referring to the same table twice in a single query, wanting different values each time. this necessitates that we use aliases (the keyword 'AS' helps us with this) and also a JOIN. I'm really bad at joins in sql, but I think this might be what you want...i haven't go the club IDs in there but it doesn't seem to me like you want them? i imagine that a club id would be '1' and not 'Fenway Park' or whatever. if i assume correctly, try this:
$sql = "SELECT f1.matchDate, s1.clubName AS homeClubName, s2.clubName AS awayClubName
FROM $table as f1 LEFT OUTER JOIN $table1 AS s1 ON f1.homeClubID=s1.clubID LEFT OUTER JOIN $table1 AS s2 ON f1.awayClubID=s2.clubID AND f1.matchDate = '2004-04-30';";
You might also want to clean up your query parsing code....your if statement reports an error if nothing is returned but then goes on to parse the non-existent data anyway. move that parsing into an ELSE clause. also, you run the query a few times...once is enough.
OH...if you want the club ids too, you just need to change the first part of the select statement...something like this (i haven't test it...you can 😃 ):
$sql = "SELECT f1.matchDate, f1.homeClubID, s1.clubName AS homeClubName, f1.awayClubID, s2.clubName AS awayClubName
FROM $table as f1 LEFT OUTER JOIN $table1 AS s1 ON f1.homeClubID=s1.clubID LEFT OUTER JOIN $table1 AS s2 ON f1.awayClubID=s2.clubID AND f1.matchDate = '2004-04-30';";
OH...by the way i changed the date...used my birthday instead just for testing.
you should check out PHPMYADMIN....easy to install PHP project that lets you do all KINDS of things on a database. that's how I figured this out.
hope this helps!