也许我在混合苹果和橘子——$clist 是一个带有 csv 的字符串。我无法让 $row2['$cat'] 回显任何内容。提前致谢
$cats = explode(",", $clist);
foreach($cats as $cat) {
$cat = trim($cat);
$q = "SELECT * FROM contacts WHERE id = '$cat' ";
$result = mysql_query($q, $link);
$num2=mysql_num_rows($result2);
$x = 0;
while($x < $num2) {
$row2 = mysql_fetch_array($result2);
echo $row2['$cat'];
$x++;
}
}