这条线:注意:未定义指数PHP错误
<?php echo $row_stuCompSci['Cid']; ?>
是给我未定义指数错误。但我不明白为什么在其他查询没有时会给我一个错误。这是我用过的查询。这是在Dreamweaver
mysql_select_db($database_project, $project);
$query_stuCompSci = "SELECT compsci.CSid FROM compsci WHERE NOT EXISTS (SELECT studentcourses.Cid FROM studentcourses WHERE studentcourses.Cid=compsci.CSid)";
$stuCompSci = mysql_query($query_stuCompSci, $project) or die(mysql_error());
$row_stuCompSci = mysql_fetch_assoc($stuCompSci);
$totalRows_stuCompSci = mysql_num_rows($stuCompSci);
全部由在查询中,表studentcourses有两列(SID,CID)和第二台compsci有两列,以及(CSID,学分)。
查询获取任何Cid不存在于学生课程中,当我测试查询它工作正常,但是,当我试图看到我的网站生活它给了我索引错误。如果需要,我可以在这里复制我的整个代码,但它大约有220行。
请不要使用['mysql_'](http://www.php.net/manual/en/intro.mysql.php)函数;他们正在被弃用的过程中。建议使用['mysqli_'](http://www.php.net/manual/en/book.mysqli.php)或['PDO'](http://www.php.net/manual/) en/book.pdo.php)为所有新代码。谢谢! –