** 已回答 .. 逗号后是空格。感谢大家!
当我执行以下代码时,会显示所有 $castmember 但是 mysql 仅在第一个上运行。
$getactors=explode(",", $actors);
foreach($getactors as $castmember){
$idolid="";
$srch3= "SELECT `id`,`dir` FROM `idols` WHERE `name`='$castmember'";
$result5 = mysql_query($srch3);
while ($row5 = mysql_fetch_assoc($result5)) {
$idolid = $row5["id"];
$idoldir= $row5["dir"];
}
if($idolid){ echo"<li style=\"font-size:1.2em;\" ><a href=\"/gallery/$idolid/$idoldir.html\" title=\"$castmember\" itemprop=\"actors\"> $castmember</a>";
} else {
echo"<li style=\"font-size:1.2em;\"><div style=\"display:inline\" itemprop=\"actors\"> $castmember</div>";
}
echo"<span></span></li>\n";
}