blueinc Posted March 7, 2014 Share Posted March 7, 2014 In my first page I have I have a query that returns tournaments names in a table in this format echo "<td><a href='tournament.php'>" . $info['tournament'] . "</a></td>"; $info['tournament'] has the tournament name which when clicked takes me to the page tournament.php where I have this code $data = mysql_query("SELECT team1,score1,team2,score2 FROM smite where tournament='';") or die(mysql_error()); what i want is to have the value clicked in the previous page that linked to this one, in tournament='HERE' so that the query retrieve the data for that tournament i have tried echo "<td><a href='tournament.php?tournament=".$info['tournament']."'>" . $info['tournament'] . "</a></td>"; and $tournamentName = $_GET['tournament']; $data = mysql_query("SELECT team1,score1,team2,score2 FROM smite where tournament='$tournamentName';") or die(mysql_error()); the query returns empty and when i print $tournamentName i get for example (Golden Cup) which should be (Golden Cup #1) the $_GET removed #1 which is why the query returns NULL and if i do partial match to $tournamentName i will get all the Golden Cup tournaments not just the one i clicked can anyone help me solve this problem ? Thank you Quote Link to comment https://forums.phpfreaks.com/topic/286797-passing-page-query-result-in-another-page-query/ Share on other sites More sharing options...
iwpg Posted March 7, 2014 Share Posted March 7, 2014 The code that you are using should work with ID's. I highly recommend using this for any type of match. If you don't already have an ID associated with tournaments, use auto increment when creating it. echo "<td><a href='tournament.php?id=".$info['id']."'>" . $info['tournament'] . "</a></td>"; $tournamentId = $_GET['id']; $data = mysql_query("SELECT team1,score1,team2,score2 FROM smite where tournament='$tournamentId' LIMIT 1;") or die(mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/286797-passing-page-query-result-in-another-page-query/#findComment-1471794 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.