mythri Posted June 8, 2016 Share Posted June 8, 2016 Hi,i want to display consolidated marks sheet of students. Format is same as in the attached imageI have saved my data like thisexam information will be on exam_time_table like in the image (exam_time_table.jpg), Type of exams will be stored in exam_type (exam_type.jpg), subjects will be in subjects table, exams, subject and marks related to each student will be there in student_exam.I can extract the data, but not able to display in this format. I have made format in html, but not able to fit in my data there.Here is the query i am extracting $sql="SELECT student_exam.id as sid, student_exam.student_id, student_exam.enroll_no, student_exam.exam_id, student_exam.subject_id, student_exam.obtained_marks, exam_time_table.exam_name, exam_time_table.class, exam_time_table.section, exam_time_table.total_marks, subjects.subject, exam_type.exam, student.enroll_no, student.stud_name FROM student_exam INNER JOIN exam_time_table ON student_exam.exam_id=exam_time_table.id INNER JOIN subjects ON student_exam.subject_id=subjects.sub_id INNER JOIN exam_type ON exam_time_table.exam_name=exam_type.eid INNER JOIN student ON student_exam.enroll_no=student.enroll_no WHERE exam_time_table.class='".$class."' AND exam_time_table.section='".$section."' AND student_exam.enroll_no='".$enroll_no."'"; Can somebody please let me know how to do it? Please share if you have any tutorials Tables are like in the attachment Quote Link to comment Share on other sites More sharing options...
Barand Posted June 8, 2016 Share Posted June 8, 2016 You could apply a method similar to this one http://forums.phpfreaks.com/topic/301314-displaying-data-in-tabular-form/?do=findComment&comment=1533481 I'd also start by tidying up the SQL code. You wouldn't write your php in one single line. $sql = "SELECT student_exam.id as sid , student_exam.student_id , student_exam.enroll_no , student_exam.exam_id , student_exam.subject_id , student_exam.obtained_marks , exam_time_table.exam_name , exam_time_table.class , exam_time_table.section , exam_time_table.total_marks , subjects.subject , exam_type.exam , student.enroll_no , student.stud_name FROM student_exam INNER JOIN exam_time_table ON student_exam.exam_id=exam_time_table.id INNER JOIN subjects ON student_exam.subject_id=subjects.sub_id INNER JOIN exam_type ON exam_time_table.exam_name=exam_type.eid INNER JOIN student ON student_exam.enroll_no=student.enroll_no WHERE exam_time_table.class='$class' AND exam_time_table.section='$section' AND student_exam.enroll_no='$enroll_no' "; Quote Link to comment Share on other sites More sharing options...
Psycho Posted June 8, 2016 Share Posted June 8, 2016 You could apply a method similar to this one http://forums.phpfreaks.com/topic/301314-displaying-data-in-tabular-form/?do=findComment&comment=1533481 Um, you linked to this post. I'm guessing that was a mistake. Quote Link to comment Share on other sites More sharing options...
mythri Posted June 8, 2016 Author Share Posted June 8, 2016 . You have giving the link of this post only! Quote Link to comment Share on other sites More sharing options...
Barand Posted June 8, 2016 Share Posted June 8, 2016 Um, you linked to this post. I'm guessing that was a mistake. It's a recursive solution I had both open at once and meant to link to this other one - with a very similar title. http://forums.phpfreaks.com/topic/292827-display-data-in-tabular-format-by-year-and-month/?do=findComment&comment=1498183 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.