I need help joining some tables to display more info about "races"
Here's my
working page.
What you see there is just displaying info from the "races" table.
Here's what I'm working on which is
broken.
I made the page myself, but it was a little while ago so I'm a little rusty.
Here's the code I'm trying
$query = "select * from races where race_name = '".$selection."'";
$result = mysql_query($query);
$array = mysql_fetch_array($result);
$rsClass = "select * from classes where races.race_id = rcjoin.race_id AND rcjoin.class_id = classes.class_id";
$result2 = mysql_query($rsClass);
$array2 = mysql_fetch_array($result2);
OpenTable();
echo "<br><br><center><table width=\"95%\" border=\"1\" cellpadding=\"4\" cellspacing=\"4\"
bordercolor=\"#404040\"><center>
<tr>
<td valign=\"top\">
<img src=\"images/wowc/races/".$array['race_image']."\">
<br><center>
Available Classes:
<br>
<table border=\"0\" cellpadding=\"1\" cellspacing=\"1\">
<tr>
for ($i=0; $i <$num_results; $i++)
{ /* THIS IS LINE 95*/
$array2 = mysql_fetch_array($result2);
echo "echo "<td><span class=\"contentsmall\"><center>".$array2['class']."</center></span></td>
".$array['classes']."
</center>
</tr>
</table>
</td>
<td>
<table width=\"100%\" cellpadding=\"5\">
<tr>
<td>
<img src=\"/themes/$ThemeSel/images/titles/races/".$array['race_timg']."\"><br><br>
".$array['race_description']."<br>
<center><br>
Starting Location(s):<br>
".$array['start_loc']."
</center>
<img src=\"images\spacer.gif\" width=\"350\">
</td>
</tr>
</table>
</td>
</tr></center></table></center><br><br>";
CloseTable();
On the page that works, it's displaying what's in the classes cell of the races table but my whole goal here is to make it relational.
Now, the error is on line 95 but even if I comment out lines 92-103 I still get an error on line 95
Parse error: parse error, unexpected T_ECHO, expecting ',' or ';' in c:\webhost4life_aspnet\robbieb\modules\Racetest\index.php on line 95
The only difference between the 2 pages I've linked to are that on the racetest one, I've added the
$rsClass = "select * from classes where races.race_id = rcjoin.race_id AND rcjoin.class_id = classes.class_id";
$result2 = mysql_query($rsClass);
$array2 = mysql_fetch_array($result2);
And of course, the table in the middle that is supposed to display the results.
I THOUGHT I was on the right track but it looks like I'm gonna need a lot of help
Here are some snapshots of the tables I'm trying to join.
http://www.wowcentral.com/random/races.gif
http://www.wowcentral.com/random/rc_join.gif
http://www.wowcentral.com/random/classes.gif
I'm betting my error is mainly cause I don't know how to do the SQL...
Thanks for reading