Still not getting anywhere with this.
// Make sure they entered something in the movie name. If not, write error message and set $valid = false
if (empty($movieName)) {
echo “A name for the movie is required”;
$valid = false;
}
// Make sure the movie Name is not too long for the database
if (strlen($movieName) > 30) {
echo “
Movie name must be no more then 30 characters long
”;
$valid = false;
}
//Check to see if the name is already in the database
$query = “SELECT * FROM movies WHERE name = $movieName”;
$result = mysql_query($query);
if (!empty($result)) {
echo “
$result is already in the database”;
$valid = false;
}
The first 2 checks work, if the $movieName is empty or has too many characters. The 3rd check where I am trying to make sure the movie is not already in the database does not work. I have tried many different variations on the IF statement but each time I try this out it will either let me put in duplicates or it will not let me put anything in at all.