我需要选择具有特定名称的用户:
mysql_query('select * from user where screen_name='.$userName.'');
任何人都可以在我错的地方帮助我?
答案 0 :(得分:0)
是错误的sql:
mysql_query('select * from user where screen_name="'.$userName.'"');
答案 1 :(得分:0)
mysql_query("select * from user where screen_name = '".$userName."';");
更好(在我看来)
$sql = "SELECT * FROM `user` WHERE `screen_name` = '".$userName."';";
mysql_query($sql);
更好 - 使用mysqli ....
答案 2 :(得分:-1)
mysql_query("select * from user where screen_name='$userName'");
尝试.....