Your query needs work, you need to first check to see if it returns anything using phpmyadmin or mysql workbench.
$result = mysql_query("SELECT s1.name, s2.subject_name, s3.semester,s4.section FROM Student as s1, pelajar as s2, student_subject s3 WHERE semester = '". $name ."' AND s3.matric = s1.matric
AND s2.subject_code = s3.subject_code");
and see if it returns something by saying this:
$rowFlag = mysql_num_rows($result);
if($rowFlag <= 0)
// debug error here, no results returned.
// do output work
if that doesn't work try checking your query. Also no usernmae,password, or host is selected in the connect statement so your not connected to any resources and no database is selected either.