【发布时间】:2011-08-08 14:34:50
【问题描述】:
我有:
$array1 = //contains places ids and locations;
$array2 = array();
$array3 = array();
foreach($array1 as $itemz)
{
$array2[] = $itemz[place][id];
$array3[] = $itemz[place][location][city];
$sql = "select * from places where id=".$array2." and location=".$array3."";
}
但是当我打印 $sql 我得到:
select * from places where id=12 and location=Array
谁能告诉我代码有什么问题?
谢谢!
【问题讨论】:
-
你期待什么输出?
-
当 $array2 是一个数组时,我完全不知道他/她是如何得到
id=12的。 -
SQL注入警告:使用mysql_real_escape_string()保护自己。