第9行C:includes\topic\u list.php中未定义的索引:topic
您试图使用$\u GET['topic'],但没有先检查它是否存在,这就是为什么会出现该错误。我建议您首先使用is_set()或empty()测试变量是否存在第9行C:includes\topic\u list.php中未定义的索引:topic,php,mysql,error-handling,syntax-error,undefined,Php,Mysql,Error Handling,Syntax Error,Undefined,您试图使用$\u GET['topic'],但没有先检查它是否存在,这就是为什么会出现该错误。我建议您首先使用is_set()或empty()测试变量是否存在 <?php $qr_topic = @mysql_query("SELECT * FROM topics"); while ($topic = @mysql_fetch_array($qr_topic)) {
<?php
$qr_topic = @mysql_query("SELECT * FROM topics");
while ($topic = @mysql_fetch_array($qr_topic)) {
$highlight = "";
**if ($topic['name'] == $_GET['topic'] || $post['topic_id'] == $topic['id']) {**
$highlight = "class='highlight'";
}
echo "<li ".$highlight."><a href='index.php?topic=".$topic['name']."'>".$topic['name']."<img src='img/".$topic['image']."' width='195' height='90' /></a></li>";
}
?>