As you can see from the code below im very new to PHP, so please excuse the newbie question but ive been struggling with this all afternoon and just cant figure out what exactly is the problem.
Basically Ive got 3 dropdown menus for team1, team2 and venue. When user selects teams and venue an isset function is triggered and I extract the result from the game out of my database.
As you can see in the code below I use 3 echo statements to test if correct values from dropdown menus has been captured. When I open the page the echo statements confirm the correct results are captured from the drop-downs, I go on and query the database with the variables I echoed above.
The Problem
In the while loop, I want to echo the results from the query BUT nothing gets displayed. I tried doing a var_dump to see the contents of the variables but NOTHING gets displayed. What am I doing wrong?
foreach($_REQUEST["team1"] as $teamone){
$team1 = $teamone;
}
foreach($_REQUEST["team2"] as $teamtwo){
$team2 = $teamtwo;
}
foreach($_REQUEST['venue'] as $venue){
$venue = $venue;
}
//These echo statments are a test to see if the correct dropdown values has been captured
echo $team1.'<br>';
echo $team2.'<br>';
echo $venue;
//Use results from dropdown menu to query database
$result = mysql_query('SELECT *
FROM `results`
WHERE `hometeam` = "$team1" && `awayteam` = "$team2"') or
die(mysql_error());
while($row = mysql_fetch_array($result)){
echo $row['awayteamscore'];
echo $row['hometeamscore'];
}
If anyone can point me in the right direction it would be greatly appreciated.
mysql_operations.