Jump to content

What is missing in this query?


refiking

Recommended Posts

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;
}

 

Link to comment
https://forums.phpfreaks.com/topic/90769-what-is-missing-in-this-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.