gpt4 book ai didi

php - mysql_fetch_assoc 未获取数据

转载 作者:行者123 更新时间:2023-11-29 08:03:13 24 4
gpt4 key购买 nike

我目前正在尝试传递电影的类型,但出现以下错误:

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) 字符串(1) "6"

最佳答案

您的SELECT未返回id_genre

$genre_match = mysql_query("SELECT id_genre FROM genre WHERE genre='$genre'")or die(mysql_error());

关于php - mysql_fetch_assoc 未获取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23256131/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com