[-razer-]Blade Posted December 14, 2007 Share Posted December 14, 2007 I have been reading my book and tons of articles on the net. I just can't seem to get the hang of joining tables correctly. :'( Anyway here is the problem I face. I have 3 tables. One table holds the leagues that my team plays in another holds the maps that we play on and the last one is my match table that tells us information about the match Ex: what league it is in what map it's on date time etc. We have two maps that we could possibly play on. But when I echo the second one it just displays the first one again. here is my code. <?php include 'dbconnect.php'; $match_id = $_GET['match_id']; $query = mysql_query("SELECT * FROM leagues, matches, maps WHERE matches.match_id = '$match_id' AND maps.map_id = matches.match_map AND matches.match_league = leagues.league_id"); while($row = mysql_fetch_array($query)) { $map_image = $row['map_image']; $league_small_image = $row['league_small_image']; $match_status = $row['match_status']; $match_date = $row['match_date']; $match_opponent = $row['match_opponent']; $match_opponent_tag = $row['match_opponent_tag']; $match_map = $row['map_name']; $match_map_two = $row['map_name']; $our_score = $row['our_score']; $their_score = $row['their_score']; if($match_status == '1'){$match_status = "Played";} else {$match_status = "<i>Pending</i>";} if($match_status == '<i>Pending</i>'){$match_result = "<i>Pending</i>";} elseif($our_score > $their_score){$match_result = '<img src="images/win.gif">';} elseif($our_score < $their_score){$match_result = '<img src="images/loss.gif">';} elseif($our_score == $their_score){$match_result = '<img src="images/draw.gif">';} ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="12"><img src="images/content_top_left.png" width="12" height="12" alt="" /></td> <td class="content_top"></td> <td width="12"><img src="images/content_top_right.png" alt="" width="11" height="12" /></td> </tr> <tr> <td class="content_left"></td> <td class="content_main"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td rowspan="13"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"><img src="images/maps/<?php echo $map_image; ?>" width="140" height="78"></td> </tr> <tr> <td align="center"><img src="<?php echo $league_small_image; ?>" width="18" height="16"></td> </tr> </table></td> <td>Status:</td> <td><?php echo $match_status; ?></td> </tr> <tr> <td>Date:</td> <td><?php echo date("D. M. jS", strtotime($match_date)); ?></td> </tr> <tr> <td>Time:</td> <td><?php echo date("g:i a", strtotime($match_date)); ?> EST</td> </tr> <tr> <td>Opponent:</td> <td><?php echo $match_opponent; ?></td> </tr> <tr> <td>Opponent Tag:</td> <td><?php echo $match_opponent_tag; ?></td> </tr> <tr> <td>Map One:</td> <td><?php echo $match_map; ?></td> </tr> <tr> <td>Map Two:</td> <td><?php echo $match_map_two; ?></td> </tr> <tr> <td>Result:</td> <td><?php echo $match_result; ?></td> </tr> <tr> <td>Our Score:</td> <td><?php echo $our_score; ?></td> </tr> <tr> <td>Their Score:</td> <td><?php echo $their_score; ?></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> </table></td> <td class="content_right"></td> </tr> <tr> <td width="12"><img src="images/content_bottom_left.png" alt="" width="12" height="25" /></td> <td class="content_bottom"></td> <td width="12"><img src="images/content_bottom_right.png" alt="" width="11" height="25" /></td> </tr> </table> <?php } ?> Quote Link to comment Share on other sites More sharing options...
derrick24 Posted December 14, 2007 Share Posted December 14, 2007 I don't know but as a last resort try using "UNION" to join your 3 tables. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.