Jump to content

Displaying data in tabular form


mythri

Recommended Posts

Hi,

i want to display consolidated marks sheet of students. Format is same as in the attached image

I have saved my data like this

exam 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

 

post-168283-0-07518000-1465363070_thumb.png

post-168283-0-19353200-1465363077_thumb.jpg

post-168283-0-66473700-1465363085_thumb.png

post-168283-0-74216300-1465363102_thumb.png

Link to comment
Share on other sites

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' ";
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.