Reputation: 43
I am currently trying to pass the genre of a movie but I am getting the following errors:
Notice: Undefined index: id_genre in --- on line 34
Notice: Undefined index: id_genre in --- on line 35
Incorrect integer value: '' for column 'id_genre' at row 1
$genre = ($_POST['genre']);
$genre_match = mysql_query("SELECT genre FROM genre WHERE genre='$genre'")or die(mysql_error());
$row_genre_match = mysql_fetch_assoc($genre_match);
$genre_id = $row_genre_match['id_genre'];
$insert_genre = mysql_query("INSERT INTO film_genre (`id_film` , `id_genre`) VALUES ('$fid','$genre_id')")or die(mysql_error());
int(41) string(1) "6"
Upvotes: 0
Views: 52
Reputation: 1364
Your SELECT
not return id_genre
$genre_match = mysql_query("SELECT id_genre FROM genre WHERE genre='$genre'")or die(mysql_error());
Upvotes: 2