I am trying to construct a simple SELECT query and am not sure of the correct syntax using single and double quotes
$check = mysql_query("SELECT * FROM analysed WHERE team = ".'$team');
I am trying to construct a simple SELECT query and am not sure of the correct syntax using single and double quotes
$check = mysql_query("SELECT * FROM analysed WHERE team = ".'$team');
Single quotes are for literal strings, and in the code above will produce the string $team
(literally) - but you also need those single quotes in your query if $team
is a string due to MySQL syntax:
$check = mysql_query("SELECT * FROM analysed WHERE team = '".$team. "'");
$check = mysql_query("SELECT * FROM analysed WHERE team = '{$team}'");
$check = mysql_query("SELECT * FROM analysed WHERE team = '$team'");
All of the above should work.
Double quotes (or 'magic' quotes) allow variables to be used as part of the string.