Hi there,
This is my first post and I quite new to PHP so this is probably quite a common problem that is easily sorted so bare with me please if I'm being too much of a noob.
I have a small 5 a side football league website and Im trying insert data into the league table. All of the queries below return the correct results when I run them individualy in MySQL and when a echo the results, however when I try the INSERT statement ($UPDATE) every entry shows up in the league_table as 0 apart from $ID and $NAME because they are currently text.
To me this looks like the correct syntax but im obviously missing something and your opinion on the subject would be most appreciated.
$ID = mysql_query("SELECT team_id FROM team WHERE team_name = 'Avengers'");
$NAME = mysql_query ("SELECT team_name FROM team WHERE team_name = 'Avengers'");
$P = mysql_query ("SELECT COUNT(team_name) FROM performance WHERE team_name='Avengers'");
$W = mysql_query ("SELECT COUNT(team_name) FROM performance WHERE team_name = 'Avengers' AND result = 'Win' ");
$D = mysql_query ("SELECT COUNT(team_name) FROM performance WHERE team_name ='Avengers' AND result='Draw'");
$L = mysql_query ("SELECT COUNT(team_name) FROM performance WHERE team_name ='Avengers' AND result='Lost'");
$GF = mysql_query ("SELECT SUM(goals_scored) FROM performance WHERE team_name='Avengers'");
$GA = mysql_query (" SELECT SUM(goals_scored) FROM performance WHERE NOT team_name = 'Avengers' AND game_id =6 ");
$UPDATE = mysql_query ("INSERT INTO league_table (team_id, team_name, played, won, drawn, lost, goals_for, goals_against)
VALUES ('$ID', '$NAME', '$P', '$W', '$D', '$L', '$GF', '$GA'");
(PS - I will be changing the team name in the queries to a SESSION ID later once I have this figured)