Jump to content

Warning: mysql_fetch_assoc() expects parameter 1 to be resource...


MDanz

Recommended Posts

Warning:  mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\xampp\test.php on line 58

 

line 58 is the where the while loop starts.. what have i done wrong?

 

$query2 = mysql_query("SELECT student.SID, course.CID FROM student, course WHERE student.SID = `student-course.SID` AND course.CID = `student-course.CID` AND GRADE BETWEEN $beginning AND $grade",$this->connect);

			while($row = mysql_fetch_assoc($query2)) {

			$sid = $row['student.SID'];
			$cid = $row['course.CID'];

			echo "$sid-$cid";

			}

ok after some changing up i get this message

 

Notice:  Undefined index: student.SID in C:\xampp\test.php on line 62

Notice:  Undefined index: course.CID in C:\xampp\test.php on line 63

 

	$sid = $row['student.SID'];
			$cid = $row['course.CID'];

 

here is the query

 

$query2 = mysql_query("SELECT student.SID, course.CID FROM student, course, `student-course` WHERE student.SID = `student-course`.SID AND course.CID = `student-course`.CID AND GRADE BETWEEN $beginning AND $grade",$this->connect)or die(mysql_error());

 

this is a relational database...can you see whats wrong?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.