JJohnsenDK Posted January 5, 2007 Share Posted January 5, 2007 HeyI have these two tables:seasons:seasons_ID: 1 - year: 2006seasons_ID: 2 - year: 2005seasons_ID: 3 - year: 2004actions:game_ID: 1 - season_ID: 1game_ID: 2 - season_ID: 1And this query:[code]<?php//query$sql = "SELECT MAX(s.year) AS year FROM seasons AS s LEFT JOIN actions AS a ON s.seasons = a.season_ID";$result = mysql_query($sql) or die(mysql_error());$row = mysql_fetch_array($result);//This if code says if year(2006) is = season_ID(1) print thisif($row['year'] == $row['season_ID']){?><table> <tr> <td>View this text</td> </tr></table><?php}else{ echo "No data";}?>[/code]This code is just a fast example on what i need. As i wrote in the comment over this if statement the two numbers doesnt match. My quesstion is: How do i get the season_ID to be equal to year? Or if you see a total different way to do this plz tell. I could change the season_ID to 2006, but that would be duplication because i also use the seasons table elsewhere.Any help would be great :) Link to comment https://forums.phpfreaks.com/topic/32944-a-little-help-here/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.