我四处看了一下,试了一些东西,但是我好像没办法让它起作用。。。有人能帮忙吗?

$typeall = " ('House','Condo','Loft','Townhouse','Land')";

$rs = mysql_query("SELECT * FROM 'houses' WHERE and category IN " .$typeall);

不起作用
但如果我打字
$rs = mysql_query("SELECT * FROM 'houses' WHERE and category IN ('House','Condo','Loft','Townhouse','Land')");

很完美,为什么?
谢谢。

最佳答案

试试这个:

$typeall = "'House','Condo','Loft','Townhouse','Land'";

$rs = mysql_query("SELECT * FROM 'houses' WHERE and category IN (".$typeall.")");

可能是变量$typeall在括号中不起作用。

08-24 19:37