I'm trying to pull a list of my actors via the foreign key stored in my main 'movies' table. It will work if all actor fields are populated, but will die if any one of those fields are NULL.
$stars = mysql_query("
SELECT actor_name
FROM actors
WHERE actorID = $row[5] OR actorID = $row[6] OR actorID = $row[7] OR actorID = $row[8] OR actorID = $row[9] OR actorID = $row[10]
")
or die("<h1>Error - (stars) the query could not be executed</h1>
");
$count = 0;
while ($row_stars = mysql_fetch_array($stars)) {
print("$row_stars[0]<br/>
");
if ($count == 2) {
print("</td>
");
print("<td>
");
}
$count++;
}
print("</td>
</tr>
");
Whats the best way to handle this?
Cheers,
Sam