what my code does right now is echo the links from MySQL where movie_id is equal to the GET id. what I want to add is make it echo a message like "No links were fond" if there are no links where movie_id = id
<?php
// set the _GET id
if(isset($_GET["id"])){
$id = preg_replace('#[^a-z0-9]#i', '', $_GET['id']);
} else {
header("location: /");
exit();
}
// display data
$query = "SELECT * FROM links WHERE movie_id='$id'";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)) {
echo "<a href=\"".$row['url']."\" target=\"_blank\">link</a>";
}
?>