Mysqli语句无法执行WHERE NOT子句

时间:2015-10-25 20:48:44

标签: php mysqli

任何人都可以看到为什么这句话不起作用? 我试图选择除$ creator中的值以外的所有值,我知道该值已设置,因为查询下方的echo语句显示了值,

$this->res = mysqli_query($con,"SELECT * FROM escrow WHERE name !=$creator  "); 

我发现这有效:
    $ this-> res = mysql_query(" SELECT * FROM challenge_created WHERE name!=' $ creator'");

但这不起作用:     $ this-> res = mysqli_query($ conn," SELECT * FROM challenge_created WHERE name!=' $ creator'");

显然,在2

的后一个地方,语法是错误的

1 个答案:

答案 0 :(得分:1)

试试这个: -

$this->res = mysqli_query($con,"SELECT * FROM escrow WHERE name !='$creator'");