php查询mysql数据库 查询条件替中文字符串变量时无法查询

$temp2 ='十年';

mysql_query("SET NAMES GBK");

$res = mysql_query("select songer_name from song_tab where song_name ='十年'");

可以查询出结果

但是

$temp2 ='十年';

mysql_query("SET NAMES GBK");

$res = mysql_query("select songer_name from song_tab where song_name =$temp2");

就不行了

$res = mysql_query("select songer_name from song_tab where song_name ='$temp2'");

或 ‘{$temp2'}’都可以