refiking Posted February 12, 2008 Share Posted February 12, 2008 I don't get it. It won't return the value, but it does run the query. When I put the values from one of the records in the code (as opposed to the $winner and $loser variables), it returned the correct value. Here's the code. include 'cont.php'; $winner = $_GET['winner']; $loser = $_GET['loser']; $sql = mysql_query("SELECT * FROM scores WHERE home = '$winner' AND away = 'loser'"); while ($row = mysql_fetch_assoc($sql)){ $home = $row['home']; $away = $row['away']; Echo $home; } $sql2 = mysql_query("SELECT * FROM scores WHERE home = '$loser' AND away = '$winner'"); while ($row2 = mysql_fetch_assoc($sql2)){ $home = $row2['home']; $away = $row2['away']; Echo $home; } Quote Link to comment https://forums.phpfreaks.com/topic/90769-what-is-missing-in-this-query/ Share on other sites More sharing options...
revraz Posted February 12, 2008 Share Posted February 12, 2008 Forgot the $ for loser $sql = mysql_query("SELECT * FROM scores WHERE home = '$winner' AND away = '$loser'"); Quote Link to comment https://forums.phpfreaks.com/topic/90769-what-is-missing-in-this-query/#findComment-465281 Share on other sites More sharing options...
refiking Posted February 12, 2008 Author Share Posted February 12, 2008 ahhh. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/90769-what-is-missing-in-this-query/#findComment-465295 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.