DarkerAngel Posted February 26, 2008 Share Posted February 26, 2008 No I understand what he's doing now, but he has no default set, since his script is url query string dependent a url query string is required, if it is not set he will get no output, if he wants output with no url query set he needs to add <?php if(!isset($_GET['id']) && !isset($_GET['type']) && !isset($_GET['format']) { //DEFAUTL / NOTHING SET DATA } ?> At the end of his script Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted February 26, 2008 Share Posted February 26, 2008 i was thinking the same thing dark was wondering if it was because he had no else statement after all his issets so if nothing was selected or entered it showed up as nothing Quote Link to comment Share on other sites More sharing options...
revraz Posted February 26, 2008 Share Posted February 26, 2008 Which is what I said before... If you got that error then error reporting is already on, which means the reason you are not getting output is because 'id' is not set. if (isset($_GET['id'])) All your code output relies on this first if statement, if it isn't true, you get nothing. All your other IF's are nested under this one. Should they be on the same level? Add a else at the bottom and echo something if 'id' is not set. Quote Link to comment Share on other sites More sharing options...
jedney Posted February 26, 2008 Author Share Posted February 26, 2008 Maybe I am not fully understanding. I do have an else statement at the end, that is supposed to display a default page, if no variables are a part of the URL. Let me repaste my code: <?php ini_set('error_reporting',E_ALL); $id=$_GET['id']; if ($_GET['id']) { $query = "SELECT * FROM matches WHERE id = '{$_GET['id']}'"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo " <td valign=\"top\" class=\"NewsHeader\"> " . $row['type'] . " " . $row['format'] . " on " . $row['date'] . " vs. " . $row['opponent'] . "</td> </tr> <tr> <td class=\"norm\">Date: " . $row['date'] . "</td> </tr> <tr> <td class=\"norm\">Time: " . $row['time'] . "</td> </tr> <tr> <td class=\"norm\">Opponent: " . $row['opponent'] . "</td> </tr> <tr> <td class=\"norm\">Match Type: " . $row['type'] . "</td> </tr> <tr> <td class=\"norm\">Opponent: " . $row['format'] . "</td> </tr> <tr> <td class=\"norm\">Map: " . $row['map'] . "</td> </tr> <tr> <td class=\"norm\">Score: " . $row['score'] . "</td> </tr> <tr> <td class=\"norm\">Match Result: " . $row['result'] . "</td> </tr> <tr> <td class=\"normbold\">Match Write Up</td> </tr> <tr> <td class=\"norm\">" . $row['writeup'] . "</td> </tr>"; } if (isset($_POST['opp'])) { $query = "SELECT * FROM opponents WHERE opp = '{$_GET['id']}'"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo " <td valign=\"top\" class=\"NewsHeader\"> " . $row['name'] . "</td> </tr> <tr> <td class=\"norm\">Clan Tag: " . $row['tag'] . "</td> </tr> <tr> <td class=\"norm\">IRC Channel: " . $row['irc'] . "</td> </tr>"; } if (isset($_POST['type'])) { $query = "SELECT * FROM matches WHERE type = '3v3'"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo "<tr> <td colspan=\"6\" valign=\"top\" class=\"NewsHeader\"> 3v3 Matches</td>"; echo "</tr>"; echo "<tr>"; echo "<td class=\"normbold\">Date & Time</td>"; echo "<td class=\"normbold\">Type & Format</td>"; echo "<td class=\"normbold\">Opponent</td>"; echo "<td class=\"normbold\">Map</td>"; echo "<td class=\"normbold\">Score</td>"; echo "<td class=\"normbold\">Result</td>"; echo "</tr>"; // DISPLAY NEWS INFORMATION echo "<td class=\"norm\"><a href=\"matches.php?id=" . $row["id"] . "\">" . $row["date"] . "</a> " . $row['time'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?type=" . $row["type"] . "\">" . $row["type"] . "</a> " . $row['format'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?opp=" . $row["opponent.id"] . "\">" . $row["name"] . "</a></td>"; echo "<td class=\"norm\">" . $row['map'] . "</td>"; echo "<td class=\"norm\">" . $row['score'] . "</td>"; echo "<td class=\"norm\">" . $row['result'] . "</td>"; echo "</tr>"; } if (isset($_POST['type'])) { $query = "SELECT * FROM matches WHERE type = '6v6'"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo "<tr> <td colspan=\"6\" valign=\"top\" class=\"NewsHeader\"> 6v6 Matches</td>"; echo "</tr>"; echo "<tr>"; echo "<td class=\"normbold\">Date & Time</td>"; echo "<td class=\"normbold\">Type & Format</td>"; echo "<td class=\"normbold\">Opponent</td>"; echo "<td class=\"normbold\">Map</td>"; echo "<td class=\"normbold\">Score</td>"; echo "<td class=\"normbold\">Result</td>"; echo "</tr>"; // DISPLAY NEWS INFORMATION echo "<td class=\"norm\"><a href=\"matches.php?id=" . $row["id"] . "\">" . $row["date"] . "</a> " . $row['time'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?type=" . $row["type"] . "\">" . $row["type"] . "</a> " . $row['format'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?opp=" . $row["id"] . "\">" . $row["name"] . "</a></td>"; echo "<td class=\"norm\">" . $row['map'] . "</td>"; echo "<td class=\"norm\">" . $row['score'] . "</td>"; echo "<td class=\"norm\">" . $row['result'] . "</td>"; echo "</tr>"; } if (isset($_POST['type'])) { $query = "SELECT * FROM matches WHERE type = 'tpg'"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo "<tr> <td colspan=\"6\" valign=\"top\" class=\"NewsHeader\"> TPG Matches</td>"; echo "</tr>"; echo "<tr>"; echo "<td class=\"normbold\">Date & Time</td>"; echo "<td class=\"normbold\">Type & Format</td>"; echo "<td class=\"normbold\">Opponent</td>"; echo "<td class=\"normbold\">Map</td>"; echo "<td class=\"normbold\">Score</td>"; echo "<td class=\"normbold\">Result</td>"; echo "</tr>"; // DISPLAY NEWS INFORMATION echo "<td class=\"norm\"><a href=\"matches.php?id=" . $row["id"] . "\">" . $row["date"] . "</a> " . $row['time'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?type=" . $row["type"] . "\">" . $row["type"] . "</a> " . $row['format'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?opp=" . $row["id"] . "\">" . $row["name"] . "</a></td>"; echo "<td class=\"norm\">" . $row['map'] . "</td>"; echo "<td class=\"norm\">" . $row['score'] . "</td>"; echo "<td class=\"norm\">" . $row['result'] . "</td>"; echo "</tr>"; } if(!isset($_GET['id']) && !isset($_GET['type']) && !isset($_GET['format'])) { echo "<tr> <td colspan=\"6\" valign=\"top\" class=\"NewsHeader\"> Matches</td>"; echo "</tr>"; echo "<tr>"; echo "<td class=\"normbold\">Date & Time</td>"; echo "<td class=\"normbold\">Type & Format</td>"; echo "<td class=\"normbold\">Opponent</td>"; echo "<td class=\"normbold\">Map</td>"; echo "<td class=\"normbold\">Score</td>"; echo "<td class=\"normbold\">Result</td>"; echo "</tr>"; // DISPLAY NEWS INFORMATION $query = "SELECT * FROM matches"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo "<td class=\"norm\"><a href=\"matches.php?id=" . $row["id"] . "\">" . $row["date"] . "</a> " . $row['time'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?type=" . $row["type"] . "\">" . $row["type"] . "</a> " . $row['format'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?opp=" . $row["id"] . "\">" . $row["name"] . "</a></td>"; echo "<td class=\"norm\">" . $row['map'] . "</td>"; echo "<td class=\"norm\">" . $row['score'] . "</td>"; echo "<td class=\"norm\">" . $row['result'] . "</td>"; echo "</tr>"; } } } } } } } ?> Towards the end, i REMOVED the else statement, and included the if statements that DarkerAngle suggested. Quote Link to comment Share on other sites More sharing options...
jedney Posted February 26, 2008 Author Share Posted February 26, 2008 I'm so sorry guys, I just am to a point where I'm not fully understanding anymore, what I've done wrong. I've checked everything, I have brackets in proper places, I've played with the indenting, I've changed some things around, tried to set variables, nothing. Quote Link to comment Share on other sites More sharing options...
revraz Posted February 26, 2008 Share Posted February 26, 2008 Where are you trying to GET the id from here? $id=$_GET['id']; Quote Link to comment Share on other sites More sharing options...
DarkerAngel Posted February 26, 2008 Share Posted February 26, 2008 Where are you trying to GET the id from here? $id=$_GET['id']; He's in the end he's going to generate links, so it will be a URL Query string page.php?id=value Quote Link to comment Share on other sites More sharing options...
jedney Posted February 26, 2008 Author Share Posted February 26, 2008 Yes. I have done this scripting before, but only where ?id=#. In this, I have additional if statements, for other values such as type=#, format=# and opp=#. See here... If statement I wrote that works; only 1 if-statement present <? if (isset($_GET['id'])) { $query = "SELECT * FROM roster WHERE id = '{$_GET['id']}'"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo" <td valign=\"top\" class=\"NewsHeader\"> ". $row['name'] ."</td> </tr> <tr> <td class=\"normbold\">Member Information</td> </tr> <tr> <td class=\"norm\">Name: ". $row['rlname'] ."</td> </tr> <tr> <td class=\"norm\">Date of Birth: ". $row['dob'] ."</td> </tr> <tr> <td class=\"norm\">Location: ". $row['location'] ."</td> </tr> <tr> <td class=\"norm\">Clan Rank: ". $row['rank'] ."</td> </tr> <tr> <td class=\"norm\">Recruitment Date: ". $row['joindate'] ."</td> </tr> <tr> <td class=\"norm\"> </td> </tr> <tr> <td class=\"normbold\">Contact Information</td> </tr> <tr> <td class=\"norm\">Email: ". $row['email'] ."</td> </tr> <tr> <td class=\"norm\">Steam: ". $row['steam'] ."</td> </tr> <tr> <td class=\"norm\">AIM: ". $row['aim'] ."</td> </tr> <tr> <td class=\"norm\">MSN: ". $row['msn'] ."</td> </tr> <tr> <td class=\"norm\">Yahoo: ". $row['yahoo'] ."</td> </tr> <tr> <td class=\"norm\">Xfire: ". $row['xfire'] ."</td> </tr> <tr> <td class=\"norm\">GSC: ". $row['gsc'] ."</td> </tr> <tr> <td class=\"norm\"> </td> </tr> <tr> <td class=\"normbold\">Game Information</td> </tr> <tr> <td class=\"norm\"><p>Experience: ". $row['exp'] ."</p> </td> </tr> <tr> <td class=\"norm\">Allied Class: ". $row['allies'] ."</td> </tr> <tr> <td class=\"norm\">Axis Class: ". $row['axis'] ."</td> </tr> <tr> <td class=\"norm\">Map: ". $row['map'] ."</td> </tr> <tr> <td class=\"norm\">Game Type: ". $row['playertype'] ."</td> </tr> <tr> <td class=\"norm\"> </td> </tr> <tr> <td class=\"normbold\">Scrim Stats</td> </tr> <tr> <td class=\"norm\">No stats to report</td> </tr> <tr> <td class=\"norm\"> </td> </tr> <tr> <td class=\"normbold\">Match Stats</td> </tr> <tr> <td class=\"norm\">No Stats to report</td> </tr>"; } } else { echo "<tr> <td colspan=\"6\" valign=\"top\" class=\"NewsHeader\"> Squad Roster</td>"; echo "</tr>"; echo "<tr>"; echo "<td class=\"normbold\">Name</td>"; echo "<td class=\"normbold\">Rank</td>"; echo "<td class=\"normbold\">SteamID</td>"; echo "<td class=\"normbold\">Allies</td>"; echo "<td class=\"normbold\">Axis</td>"; echo "<td class=\"normbold\">Recruitment Date</td>"; echo "</tr>"; // DISPLAY NEWS INFORMATION $query = "SELECT * FROM roster"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo "<tr><td class=\"norm\"><a href=\"roster.php?id=". $row["id"] ."\">". $row["name"] ."</a></td>"; echo "<td class=\"norm\">". $row['rank'] ."</td>"; echo "<td class=\"norm\">". $row['steamid'] ."</td>"; echo "<td class=\"norm\">". $row['allies'] ."</td>"; echo "<td class=\"norm\">". $row['axis'] ."</td>"; echo "<td class=\"norm\">". $row['joindate'] ."</td>"; echo "</tr>"; } } ?> As you can see in the above code, I have the coding for the roster's name linked to it's ID (roster.php?id=1), else, it shows a main page with a list of rostered gamers to choose from. I am trying to do that here, but I'm trying to use more than one if statement. Because unlike the above code, where the only details I want is the gamer, the page I'm trying to do, I'm pulling details of the match, as well as sorting by format and type, and also linking to the opponent via their field ID. I plan on re-coding tomorrow and see if there is somewhere I messed up. I will paste the code again, if anyone has any idea, feel free to post suggestion/comments. I REALLY appreciate everyone's help with this matter. I have all the time in the world, as long as I learn it as I go, I don't want answers, but I need to know where I am incorrectly coding. Again, thank you. <?php ini_set('error_reporting',E_ALL); $id=$_GET['id']; if ($_GET['id']) { $query = "SELECT * FROM matches WHERE id = '{$_GET['id']}'"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo " <td valign=\"top\" class=\"NewsHeader\"> " . $row['type'] . " " . $row['format'] . " on " . $row['date'] . " vs. " . $row['opponent'] . "</td> </tr> <tr> <td class=\"norm\">Date: " . $row['date'] . "</td> </tr> <tr> <td class=\"norm\">Time: " . $row['time'] . "</td> </tr> <tr> <td class=\"norm\">Opponent: " . $row['opponent'] . "</td> </tr> <tr> <td class=\"norm\">Match Type: " . $row['type'] . "</td> </tr> <tr> <td class=\"norm\">Opponent: " . $row['format'] . "</td> </tr> <tr> <td class=\"norm\">Map: " . $row['map'] . "</td> </tr> <tr> <td class=\"norm\">Score: " . $row['score'] . "</td> </tr> <tr> <td class=\"norm\">Match Result: " . $row['result'] . "</td> </tr> <tr> <td class=\"normbold\">Match Write Up</td> </tr> <tr> <td class=\"norm\">" . $row['writeup'] . "</td> </tr>"; } if (isset($_POST['opp'])) { $query = "SELECT * FROM opponents WHERE opp = '{$_GET['id']}'"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo " <td valign=\"top\" class=\"NewsHeader\"> " . $row['name'] . "</td> </tr> <tr> <td class=\"norm\">Clan Tag: " . $row['tag'] . "</td> </tr> <tr> <td class=\"norm\">IRC Channel: " . $row['irc'] . "</td> </tr>"; } if (isset($_POST['type'])) { $query = "SELECT * FROM matches WHERE type = '3v3'"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo "<tr> <td colspan=\"6\" valign=\"top\" class=\"NewsHeader\"> 3v3 Matches</td>"; echo "</tr>"; echo "<tr>"; echo "<td class=\"normbold\">Date & Time</td>"; echo "<td class=\"normbold\">Type & Format</td>"; echo "<td class=\"normbold\">Opponent</td>"; echo "<td class=\"normbold\">Map</td>"; echo "<td class=\"normbold\">Score</td>"; echo "<td class=\"normbold\">Result</td>"; echo "</tr>"; // DISPLAY NEWS INFORMATION echo "<td class=\"norm\"><a href=\"matches.php?id=" . $row["id"] . "\">" . $row["date"] . "</a> " . $row['time'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?type=" . $row["type"] . "\">" . $row["type"] . "</a> " . $row['format'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?opp=" . $row["opponent.id"] . "\">" . $row["name"] . "</a></td>"; echo "<td class=\"norm\">" . $row['map'] . "</td>"; echo "<td class=\"norm\">" . $row['score'] . "</td>"; echo "<td class=\"norm\">" . $row['result'] . "</td>"; echo "</tr>"; } if (isset($_POST['type'])) { $query = "SELECT * FROM matches WHERE type = '6v6'"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo "<tr> <td colspan=\"6\" valign=\"top\" class=\"NewsHeader\"> 6v6 Matches</td>"; echo "</tr>"; echo "<tr>"; echo "<td class=\"normbold\">Date & Time</td>"; echo "<td class=\"normbold\">Type & Format</td>"; echo "<td class=\"normbold\">Opponent</td>"; echo "<td class=\"normbold\">Map</td>"; echo "<td class=\"normbold\">Score</td>"; echo "<td class=\"normbold\">Result</td>"; echo "</tr>"; // DISPLAY NEWS INFORMATION echo "<td class=\"norm\"><a href=\"matches.php?id=" . $row["id"] . "\">" . $row["date"] . "</a> " . $row['time'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?type=" . $row["type"] . "\">" . $row["type"] . "</a> " . $row['format'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?opp=" . $row["id"] . "\">" . $row["name"] . "</a></td>"; echo "<td class=\"norm\">" . $row['map'] . "</td>"; echo "<td class=\"norm\">" . $row['score'] . "</td>"; echo "<td class=\"norm\">" . $row['result'] . "</td>"; echo "</tr>"; } if (isset($_POST['type'])) { $query = "SELECT * FROM matches WHERE type = 'tpg'"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo "<tr> <td colspan=\"6\" valign=\"top\" class=\"NewsHeader\"> TPG Matches</td>"; echo "</tr>"; echo "<tr>"; echo "<td class=\"normbold\">Date & Time</td>"; echo "<td class=\"normbold\">Type & Format</td>"; echo "<td class=\"normbold\">Opponent</td>"; echo "<td class=\"normbold\">Map</td>"; echo "<td class=\"normbold\">Score</td>"; echo "<td class=\"normbold\">Result</td>"; echo "</tr>"; // DISPLAY NEWS INFORMATION echo "<td class=\"norm\"><a href=\"matches.php?id=" . $row["id"] . "\">" . $row["date"] . "</a> " . $row['time'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?type=" . $row["type"] . "\">" . $row["type"] . "</a> " . $row['format'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?opp=" . $row["id"] . "\">" . $row["name"] . "</a></td>"; echo "<td class=\"norm\">" . $row['map'] . "</td>"; echo "<td class=\"norm\">" . $row['score'] . "</td>"; echo "<td class=\"norm\">" . $row['result'] . "</td>"; echo "</tr>"; } if(!isset($_GET['id']) && !isset($_GET['type']) && !isset($_GET['format'])) { echo "<tr> <td colspan=\"6\" valign=\"top\" class=\"NewsHeader\"> Matches</td>"; echo "</tr>"; echo "<tr>"; echo "<td class=\"normbold\">Date & Time</td>"; echo "<td class=\"normbold\">Type & Format</td>"; echo "<td class=\"normbold\">Opponent</td>"; echo "<td class=\"normbold\">Map</td>"; echo "<td class=\"normbold\">Score</td>"; echo "<td class=\"normbold\">Result</td>"; echo "</tr>"; // DISPLAY NEWS INFORMATION $query = "SELECT * FROM matches"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo "<td class=\"norm\"><a href=\"matches.php?id=" . $row["id"] . "\">" . $row["date"] . "</a> " . $row['time'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?type=" . $row["type"] . "\">" . $row["type"] . "</a> " . $row['format'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?opp=" . $row["id"] . "\">" . $row["name"] . "</a></td>"; echo "<td class=\"norm\">" . $row['map'] . "</td>"; echo "<td class=\"norm\">" . $row['score'] . "</td>"; echo "<td class=\"norm\">" . $row['result'] . "</td>"; echo "</tr>"; } } } } } } } ?> The code may differ slightly from my original post. Aside from the suggestions here in the forum, I have had a few others help elsewhere, including a friend. Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted February 26, 2008 Share Posted February 26, 2008 Try: <?php ini_set('error_reporting',E_ALL); $type=$_GET['type']; $id=$_GET['id']; $format=$_GET['format']; if (isset($id)) { $query = "SELECT * FROM matches WHERE id = $id"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo " <td valign=\"top\" class=\"NewsHeader\"> " . $row['type'] . " " . $row['format'] . " on " . $row['date'] . " vs. " . $row['opponent'] . "</td> </tr> <tr> <td class=\"norm\">Date: " . $row['date'] . "</td> </tr> <tr> <td class=\"norm\">Time: " . $row['time'] . "</td> </tr> <tr> <td class=\"norm\">Opponent: " . $row['opponent'] . "</td> </tr> <tr> <td class=\"norm\">Match Type: " . $row['type'] . "</td> </tr> <tr> <td class=\"norm\">Opponent: " . $row['format'] . "</td> </tr> <tr> <td class=\"norm\">Map: " . $row['map'] . "</td> </tr> <tr> <td class=\"norm\">Score: " . $row['score'] . "</td> </tr> <tr> <td class=\"norm\">Match Result: " . $row['result'] . "</td> </tr> <tr> <td class=\"normbold\">Match Write Up</td> </tr> <tr> <td class=\"norm\">" . $row['writeup'] . "</td> </tr>"; } if (isset($_GET['opp'])) { $query = "SELECT * FROM opponents WHERE opp = $id"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo " <td valign=\"top\" class=\"NewsHeader\"> " . $row['name'] . "</td> </tr> <tr> <td class=\"norm\">Clan Tag: " . $row['tag'] . "</td> </tr> <tr> <td class=\"norm\">IRC Channel: " . $row['irc'] . "</td> </tr>"; } if (isset($type)) { $query = "SELECT * FROM matches WHERE type = '3v3'"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo "<tr> <td colspan=\"6\" valign=\"top\" class=\"NewsHeader\"> 3v3 Matches</td>"; echo "</tr>"; echo "<tr>"; echo "<td class=\"normbold\">Date & Time</td>"; echo "<td class=\"normbold\">Type & Format</td>"; echo "<td class=\"normbold\">Opponent</td>"; echo "<td class=\"normbold\">Map</td>"; echo "<td class=\"normbold\">Score</td>"; echo "<td class=\"normbold\">Result</td>"; echo "</tr>"; // DISPLAY NEWS INFORMATION echo "<td class=\"norm\"><a href=\"matches.php?id=" . $row["id"] . "\">" . $row["date"] . "</a> " . $row['time'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?type=" . $row["type"] . "\">" . $row["type"] . "</a> " . $row['format'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?opp=" . $row["id"] . "\">" . $row["name"] . "</a></td>"; echo "<td class=\"norm\">" . $row['map'] . "</td>"; echo "<td class=\"norm\">" . $row['score'] . "</td>"; echo "<td class=\"norm\">" . $row['result'] . "</td>"; echo "</tr>"; } if (isset($type)) { $query = "SELECT * FROM matches WHERE type = '6v6'"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo "<tr> <td colspan=\"6\" valign=\"top\" class=\"NewsHeader\"> 6v6 Matches</td>"; echo "</tr>"; echo "<tr>"; echo "<td class=\"normbold\">Date & Time</td>"; echo "<td class=\"normbold\">Type & Format</td>"; echo "<td class=\"normbold\">Opponent</td>"; echo "<td class=\"normbold\">Map</td>"; echo "<td class=\"normbold\">Score</td>"; echo "<td class=\"normbold\">Result</td>"; echo "</tr>"; // DISPLAY NEWS INFORMATION echo "<td class=\"norm\"><a href=\"matches.php?id=" . $row["id"] . "\">" . $row["date"] . "</a> " . $row['time'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?type=" . $row["type"] . "\">" . $row["type"] . "</a> " . $row['format'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?opp=" . $row["id"] . "\">" . $row["name"] . "</a></td>"; echo "<td class=\"norm\">" . $row['map'] . "</td>"; echo "<td class=\"norm\">" . $row['score'] . "</td>"; echo "<td class=\"norm\">" . $row['result'] . "</td>"; echo "</tr>"; } if (isset($type)) { $query = "SELECT * FROM matches WHERE type = 'tpg'"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo "<tr> <td colspan=\"6\" valign=\"top\" class=\"NewsHeader\"> TPG Matches</td>"; echo "</tr>"; echo "<tr>"; echo "<td class=\"normbold\">Date & Time</td>"; echo "<td class=\"normbold\">Type & Format</td>"; echo "<td class=\"normbold\">Opponent</td>"; echo "<td class=\"normbold\">Map</td>"; echo "<td class=\"normbold\">Score</td>"; echo "<td class=\"normbold\">Result</td>"; echo "</tr>"; // DISPLAY NEWS INFORMATION echo "<td class=\"norm\"><a href=\"matches.php?id=" . $row["id"] . "\">" . $row["date"] . "</a> " . $row['time'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?type=" . $row["type"] . "\">" . $row["type"] . "</a> " . $row['format'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?opp=" . $row["id"] . "\">" . $row["name"] . "</a></td>"; echo "<td class=\"norm\">" . $row['map'] . "</td>"; echo "<td class=\"norm\">" . $row['score'] . "</td>"; echo "<td class=\"norm\">" . $row['result'] . "</td>"; echo "</tr>"; } } else { echo "<tr> <td colspan=\"6\" valign=\"top\" class=\"NewsHeader\"> Matches</td>"; echo "</tr>"; echo "<tr>"; echo "<td class=\"normbold\">Date & Time</td>"; echo "<td class=\"normbold\">Type & Format</td>"; echo "<td class=\"normbold\">Opponent</td>"; echo "<td class=\"normbold\">Map</td>"; echo "<td class=\"normbold\">Score</td>"; echo "<td class=\"normbold\">Result</td>"; echo "</tr>"; // DISPLAY NEWS INFORMATION $query = "SELECT * FROM matches"; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo "<td class=\"norm\"><a href=\"matches.php?id=" . $row["id"] . "\">" . $row["date"] . "</a> " . $row['time'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?type=" . $row["type"] . "\">" . $row["type"] . "</a> " . $row['format'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?opp=" . $row["id"] . "\">" . $row["name"] . "</a></td>"; echo "<td class=\"norm\">" . $row['map'] . "</td>"; echo "<td class=\"norm\">" . $row['score'] . "</td>"; echo "<td class=\"norm\">" . $row['result'] . "</td>"; echo "</tr>"; } } } elseif(!isset($type)){ echo"Type is not set!";} } elseif(!isset($type)){ echo"Type is not set!";} } elseif(!isset($_GET['opp'])){ echo"opp is not set!";} } elseif(!isset($id)){ echo "ID is not set!";} ?> Quote Link to comment Share on other sites More sharing options...
jedney Posted February 26, 2008 Author Share Posted February 26, 2008 Notice: Undefined index: type in /home/c575964/public_html/nlgb1/matches.php on line 82 Notice: Undefined index: id in /home/c575964/public_html/nlgb1/matches.php on line 83 Notice: Undefined index: format in /home/c575964/public_html/nlgb1/matches.php on line 84 ID is not set! I'm not understanding why ID would not be set? This has worked in other pages... Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted February 26, 2008 Share Posted February 26, 2008 try changing $_GET['id'] to $_REQUEST['id'] Quote Link to comment Share on other sites More sharing options...
jedney Posted February 26, 2008 Author Share Posted February 26, 2008 Well a friend of mine had his Dad look at my code and see what's what; his Dad is a Web Developer. I wasn't making else statements, after each if statement, I did one else statement at the end, and it was trying to check for all of my if statements at once. Here is the working code, for those of you who are curious. Thanks to those who did help, DarkerAngel, darkfreaks in particular, offered a lot of comments. <?php ini_set('error_reporting',E_ALL); if (isset($_GET['id'])) { $query = 'SELECT a.*, b.* FROM matches a, opponents b WHERE a.id = ' . $_GET['id'] . ' AND b.id= ' . $_GET['id'] . ''; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo " <td valign=\"top\" class=\"NewsHeader\"> " . $row['type'] . " " . $row['format'] . " on " . $row['date'] . " vs. " . $row['clan'] . "</td> </tr> <tr> <td class=\"norm\">Date: " . $row['date'] . "</td> </tr> <tr> <td class=\"norm\">Time: " . $row['time'] . "</td> </tr> <tr> <td class=\"norm\">Opponent: " . $row['clan'] . "</td> </tr> <tr> <td class=\"norm\">Match Type: " . $row['type'] . "</td> </tr> <tr> <td class=\"norm\">Opponent: " . $row['format'] . "</td> </tr> <tr> <td class=\"norm\">Map: " . $row['map'] . "</td> </tr> <tr> <td class=\"norm\">Score: " . $row['score'] . "</td> </tr> <tr> <td class=\"norm\">Match Result: " . $row['result'] . "</td> </tr> <tr> <td class=\"normbold\">Match Write Up</td> </tr> <tr> <td class=\"norm\">" . $row['writeup'] . "</td> </tr>"; } } else { if (isset($_GET['opp'])) { $query = 'SELECT * FROM opponents WHERE clan = "' . $_GET['opp'] . '" LIMIT 1'; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo " <td valign=\"top\" class=\"NewsHeader\"> " . $row['clan'] . "</td> </tr> <tr> <td class=\"norm\">Clan Tag: " . $row['tag'] . "</td> </tr> <tr> <td class=\"norm\">IRC Channel: " . $row['irc'] . "</td> </tr>"; } } else { if (isset($_GET['type'])) { echo "<tr> <td colspan=\"6\" valign=\"top\" class=\"NewsHeader\"> " . $_GET['type'] . " Matches</td>"; echo "</tr>"; echo "<tr>"; echo "<td class=\"normbold\">Date & Time</td>"; echo "<td class=\"normbold\">Type & Format</td>"; echo "<td class=\"normbold\">Opponent</td>"; echo "<td class=\"normbold\">Map</td>"; echo "<td class=\"normbold\">Score</td>"; echo "<td class=\"normbold\">Result</td>"; echo "</tr>"; // DISPLAY NEWS INFORMATION. $query = 'SELECT a.*, b.* FROM matches a, opponents b WHERE a.type = "' . $_GET['type'] . '" AND a.id = b.id'; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo "<td class=\"norm\"><a href=\"matches.php?id=" . $row["id"] . "\">" . $row["date"] . "</a> " . $row['time'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?type=" . $row["type"] . "\">" . $row["type"] . "</a> <a href=\"matches.php?format=" . $row["format"] . "\">" . $row['format'] . "</a></td>"; echo "<td class=\"norm\"><a href=\"matches.php?opp=" . $row["clan"] . "\">" . $row["clan"] . "</a></td>"; echo "<td class=\"norm\">" . $row['map'] . "</td>"; echo "<td class=\"norm\">" . $row['score'] . "</td>"; echo "<td class=\"norm\">" . $row['result'] . "</td>"; echo "</tr>"; } } else { if (isset($_GET['format'])) { echo "<tr> <td colspan=\"6\" valign=\"top\" class=\"NewsHeader\"> " . $_GET['format'] . " Matches</td>"; echo "</tr>"; echo "<tr>"; echo "<td class=\"normbold\">Date & Time</td>"; echo "<td class=\"normbold\">Type & Format</td>"; echo "<td class=\"normbold\">Opponent</td>"; echo "<td class=\"normbold\">Map</td>"; echo "<td class=\"normbold\">Score</td>"; echo "<td class=\"normbold\">Result</td>"; echo "</tr>"; // DISPLAY NEWS INFORMATION. $query = 'SELECT a.*, b.* FROM matches a, opponents b WHERE a.format = "' . $_GET['format'] . '" AND a.id = b.id'; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo "<td class=\"norm\"><a href=\"matches.php?id=" . $row["id"] . "\">" . $row["date"] . "</a> " . $row['time'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?type=" . $row["type"] . "\">" . $row["type"] . "</a> <a href=\"matches.php?format=" . $row["format"] . "\">" . $row['format'] . "</a></td>"; echo "<td class=\"norm\"><a href=\"matches.php?opp=" . $row["clan"] . "\">" . $row["clan"] . "</a></td>"; echo "<td class=\"norm\">" . $row['map'] . "</td>"; echo "<td class=\"norm\">" . $row['score'] . "</td>"; echo "<td class=\"norm\">" . $row['result'] . "</td>"; echo "</tr>"; } } else { echo "<tr> <td colspan=\"6\" valign=\"top\" class=\"NewsHeader\"> Matches</td>"; echo "</tr>"; echo "<tr>"; echo "<td class=\"normbold\">Date & Time</td>"; echo "<td class=\"normbold\">Type & Format</td>"; echo "<td class=\"normbold\">Opponent</td>"; echo "<td class=\"normbold\">Map</td>"; echo "<td class=\"normbold\">Score</td>"; echo "<td class=\"normbold\">Result</td>"; echo "</tr>"; // DISPLAY NEWS INFORMATION $query = 'SELECT a.*, b.* FROM matches a, opponents b WHERE a.id = b.id'; $result = mysql_query($query) or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo "<td class=\"norm\"><a href=\"matches.php?id=" . $row["id"] . "\">" . $row["date"] . "</a> " . $row['time'] . "</td>"; echo "<td class=\"norm\"><a href=\"matches.php?type=" . $row["type"] . "\">" . $row["type"] . "</a> <a href=\"matches.php?format=" . $row['format'] . "\">" . $row['format'] . "</a></td>"; echo "<td class=\"norm\"><a href=\"matches.php?opp=" . $row["clan"] . "\">" . $row["clan"] . "</a></td>"; echo "<td class=\"norm\">" . $row['map'] . "</td>"; echo "<td class=\"norm\">" . $row['score'] . "</td>"; echo "<td class=\"norm\">" . $row['result'] . "</td>"; echo "</tr>"; } } } } } ?> Quote Link to comment Share on other sites More sharing options...
darkfreaks Posted February 27, 2008 Share Posted February 27, 2008 did we not tell you this last night? that you had everyone nested and no else statements? Quote Link to comment Share on other sites More sharing options...
jedney Posted February 27, 2008 Author Share Posted February 27, 2008 I didn't realize what you meant! Thank you though. Quote Link to comment Share on other sites More sharing options...
revraz Posted February 27, 2008 Share Posted February 27, 2008 I think I said it twice. did we not tell you this last night? that you had everyone nested and no else statements? 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.