我不知道为什么它一直告诉我
mysql_num_rows() 期望参数 1 是资源,布尔值在第 44 行的 C:\xampp\htdocs\schedule2\course.php 中给出
if(isset ($_POST['course']) && isset($_POST['coursedesc']))
{
$course = $_POST['course'];
$coursedesc = $_POST['coursedesc'];
$query = mysql_query("SELECT * FROM ".tblurser." WHERE CourseCode ='".$course."' and CourseDescription = '".$coursedesc."'");
if(mysql_num_rows($query) > 0)
{
echo"<script>alert('Data already exist.');</script>";
}else{
if(empty($course) or empty($coursedesc))
{
echo "<script>
alert(\"all fields are required \");
</script>";
}else{
if(mysql_query("INSERT INTO tblcourse VALUES('','$course','$coursedesc')"))
{
}ELSE{
echo"<script>
alert(\"Please try again\");
</script>";
}
}
}
}