Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Php Separated Table

Links for php scripts

Moderators: macek, egami, gesf

Php Separated Table

Postby IamNew » Tue Apr 24, 2012 7:06 pm

Hi there, I have a create a table for the list of the course taken by university student with the grade point. But all the courses with all grade point are in a table but I need the courses with the grade point of 4.00 to be displayed in another table. How do I do that?

The look of the table (Web):
Image

Code for the table (php design):
Code: Select all
<?php  }else{ ?>
<!-- Result Transcript Title -->
<table width="818" border="0" align="center" cellpadding="0" cellspacing="0"><!-- 1 -->
<tr align="center">
<td colspan="2"height="23"><strong style="font-size: 14px; color: #E0FFFF;">Result Transcript</strong></td>
</tr>
<tr>
<td width="725" height="31" align="right">
<form id="form2" name="form2" method="post" action="">
<input name="transcript" type="hidden" id="transcript" value="add" />
<input name="lect_id" type="hidden" id="lect_id" value="<?php echo $row_lecturer['lect_id']; ?>" />
<input name="id" type="hidden" id="id" value="lect" />
<input name="y" type="hidden" id="y" value="stu" />
<input name="stu" type="hidden" id="stu" value="student" />
<input name="student_id" type="hidden" id="student_id" value="<?php echo $row_vstudent['student_id']; ?>" />
<label>
<input name="button10" type="image" id="button10" value="Add" src="image/button_add1.gif" align="top" />
</label>
</form>
</td>
<td width="93" height="31" align="right">
<form id="backform" name="backform" method="post" action="">
<input name="y" type="hidden" id="y" value="year" />
<input name="id" type="hidden" id="id" value="lect" />
<input name="lect_id" type="hidden" id="lect_id" value="<?php echo $row_lecturer['lect_id']; ?>" />
<label>
<input name="button8" type="image" id="button8" value="Submit" src="image/button_back1.gif" align="top" />
</label>
</form>
</td>
</tr>
</table>
<!-- Result Transcript Title -->
<!-- Result Transcript Table -->
<table width="818" border="1" align="center" cellpadding="1" cellspacing="1">
<tr>
<td width="97" height="22" align="center" valign="middle"><strong style="color: #FFD700">Session</strong></td>
<td width="123" height="22" align="center" valign="middle"><strong style="color: #FFD700">Course Type</strong></td>
<td width="369" height="22" align="center" valign="middle"><strong style="color: #FFD700">Course</strong></td>
<td width="73" height="22" align="center" valign="middle"><strong style="color: #FFD700">Grade</strong></td>
<td height="22" align="center" valign="middle"><strong style="color: #FFD700">Pointer</strong></td>
<td width="75" height="22" align="center" valign="middle"><strong style="color: #FFD700">Action</strong></td>
</tr>
<?php
$num=0;
do {
if($num%2==0){
$color="#D6F5F5";}else{
$color="#FFFFCC";}
$num+=1;
?>
<tr><!-- 5 -->
<td width="97" height="18" align="center" style="font-size: 11px; color:#FFFFFF; font-weight:normal"><?php echo $a1=$row_transcript['academic_year']; ?></td>
<td width="123" height="18" align="center" valign="middle" style="font-size: 11px; color:#FFFFFF; font-weight:normal"><?php echo $a2=$row_transcript['course_type']; ?></td>
<td width="369" height="18" style="font-size: 11px; color:#FFFFFF; font-weight:normal" align="left">&nbsp;<?php echo $a3=$row_transcript['course_id']; echo " - ";
$zzz = mysql_query("SELECT * FROM course WHERE course_id='$a3'");
if($zzz = mysql_fetch_assoc($zzz)){
echo $xxx=$zzz['course_name'];} ?>
</td>
<td width="73" height="18" align="center" style="font-size: 11px; color:#FFFFFF; font-weight:normal"><?php echo $a4=$row_transcript['grade_id']; ?></td>
<td width="48" height="18" align="center" style="font-size: 11px; color:#FFF; font-weight:normal">
<?php $a5=$row_transcript['grade_id'];
$zzz = mysql_query("SELECT * FROM grading WHERE grade_id='$a5'");
if($zzz = mysql_fetch_assoc($zzz)){
echo $xxx=$zzz['grade_pointer'];} ?>
</td>
<td width="75" height="18" align="center" style="font-size: 11px;">
<form id="form7" name="form7" method="post" action="">
<label>
<input name="button18" type="image" id="button18" value="Submit" src="image/butn_edit.gif" align="top" />
</label>
<input name="transcript" type="hidden" id="transcript" value="edit" />
<input name="y" type="hidden" id="y" value="stu" />
<input name="id" type="hidden" id="id" value="lect" />
<input name="lect_id" type="hidden" id="lect_id" value="<?php echo $row_lecturer['lect_id']; ?>" />
<input name="stu" type="hidden" id="stu" value="student" />
<input name="student_id" type="hidden" id="student_id" value="<?php echo $row_vstudent['student_id']; ?>" />
<input name="transcript_id" type="hidden" id="transcript_id" value="<?php echo $row_transcript['transcript_id']; ?>" />
</form>
</td>
</tr>
<?php } while ($row_transcript = mysql_fetch_assoc($transcript)); ?>
</table>
<!-- Result Transcript Table-->
<?php  } ?>


The look of the table (php design):
Image

Form code(php design)
Code: Select all
<form id="form2" name="form2" method="post" action=""><strong style="color:#FFF">&nbsp;&nbsp;
<label>
<input type="image" src="image/b_view.gif" name="button7" id="button7" value="Submit" align="top" />&nbsp;&nbsp;<u>Result Transcript</u>
</label></strong>
<input name="id" type="hidden" id="id" value="lect" />
<input name="y" type="hidden" id="y" value="stu" />
<input name="stu" type="hidden" id="stu" value="student" />
<input name="student_id" type="hidden" id="student_id" value="<?php echo $row_vstudent['student_id']; ?>" />
</form>


The look of the link (php design)
Image

Please advise and guide. thanks in advance.
IamNew
New php-forum User
New php-forum User
 
Posts: 28
Joined: Fri Nov 04, 2011 6:29 am

Re: Php Separated Table

Postby JordanMRichards » Thu Apr 26, 2012 6:30 am

Make a query that selects everything with the grade points of 4.00 or higher

like this..

Code: Select all
$query = "SELECT * FROM course WHERE pointer >= 4.00" //change "pointer" to the column name of the points.


Hope this helped :)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14 Year Old Programmer & Graphic Artist, Confident and Courageous
Image
User avatar
JordanMRichards
New php-forum User
New php-forum User
 
Posts: 84
Joined: Mon Apr 23, 2012 7:43 am

Re: Php Separated Table

Postby JordanMRichards » Thu Apr 26, 2012 10:56 am

You can then loop through that data and display it...

Here's an example..

Code: Select all
if ($query_run = mysql_query($query)) {
            while ($query_rows = mysql_fetch_assoc($query_run)) {
            echo ("Name: ".$query_rows['name'].");  // change name to the field you want to display.
            }
}


Hope this helped!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14 Year Old Programmer & Graphic Artist, Confident and Courageous
Image
User avatar
JordanMRichards
New php-forum User
New php-forum User
 
Posts: 84
Joined: Mon Apr 23, 2012 7:43 am


Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron