I've got three tables in one database named "softball_leagues".
Table one is named "leagues". This is the main table with most general information. Among others fields, it contains the fields "league_id" and "league_name".
Table two is named "divisions_list". This is only a list of different types of divisions that could possibly be offered (Men's, Women's, Co-Rec, and five more). Its only two fields: "divisions_list_id" (1-8) and "divisions" (the names of each possible division type).
If I did it right, table three is the relational table and is named "divisions_relations". Its only two fields are "league_id" (named to match table one?) and "divisions_list_id" (to match table two?).
As example, league_id 1 offers four different divisions and I want to display those four. Here's the code I tried:
<?
$db = mysql_connect("localhost", "XXXXX", "XXXXX");
mysql_select_db("softball_leagues",$db);
$result = mysql_query("select L.leagues, D.divisions from leagues L
inner
join divisions_relations DR
on L.league_id = DR.league_id
inner
join divisions_list D
on DR.divisions_list_id = D.divisions_list_id
WHERE league_id=$id",$db);
$myrow = mysql_fetch_array($result);
print "<p align=\"center\">".$myrow["divisions"]."</p>\n";
?>
Click here and you can see the page I'm testing. So can somebody tell me what I did wrong? ( The error references line 23 which is the one with $myrow = mysql_fetch_array($result); ) 😕