** ANSWERED .. Was whitespace after commas. Thanks everyone!
When I execute the following code, all $castmember are displayed however mysql is only run on the first one.
$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";
}
var_dumpon$getactors, is it the array you expect? If it is iterating more than once with the foreach, the issue might be the value in the where clause has some extra whitespace and the SQL returns no results. Could just echo$srch3in the loop to see what your building out.$getactorsincludes an apostrophe, for example, the unescaped query will be broken.