Search the Community
Showing results for tags 'exportingtocsv'.
-
<?php <?php if(isset($_REQUEST['testid'])) { /************************** Step 3 - Case 2 *************************/ // Displays the Existing Test Results in detail, If any. $result=executeQuery("select t.testname,DATE_FORMAT(t.testfrom,'%d %M %Y') as fromdate,DATE_FORMAT(t.testto,'%d %M %Y %H:%i:%S') as todate,sub.subname,IFNULL((select sum(marks) from question where testid=".$_REQUEST['testid']."),0) as maxmarks from test as t, subject as sub where sub.subid=t.subid and t.testid=".$_REQUEST['testid'].";") ; if(mysql_num_rows($result)!=0) { $r=mysql_fetch_array($result); ?> <table class="table table-striped"> <tr> <td colspan="2"><h3 style="color:#0000cc;text-align:center;">Test Summary</h3></td> </tr> <tr> <td colspan="2" ><hr style="color:#ff0000;border-width:4px;"/></td> </tr> <tr> <td>Test Name</td> <td><?php echo htmlspecialchars_decode($r['testname'],ENT_QUOTES); ?></td> </tr> <tr> <td>Subject Name</td> <td><?php echo htmlspecialchars_decode($r['subname'],ENT_QUOTES); ?></td> </tr> <tr> <td>Validity</td> <td><?php echo $r['fromdate']." To ".$r['todate']; ?></td> </tr> <tr> <td>Max. Points</td> <td><?php echo $r['maxmarks']; ?></td> </tr> <tr><td colspan="2"><hr style="color:#ff0000;border-width:2px;"/></td></tr> <tr> <td colspan="2"><h3 style="color:#0000cc;text-align:center;">Attempted Students</h3></td> </tr> <tr> <td colspan="2" ><hr style="color:#ff0000;border-width:4px;"/></td> </tr> </table> <form name="getcvs" action="try.php" method="POST"> <?php $result1=executeQuery("select s.stdname,s.stdlastname,s.emailid,IFNULL((select sum(q.marks) from studentquestion as sq,question as q where q.qnid=sq.qnid and sq.testid=".$_REQUEST['testid']." and sq.stdid=st.stdid and sq.stdanswer=q.correctanswer),0) as om from studenttest as st, student as s where s.stdid=st.stdid and st.testid=".$_REQUEST['testid'].";" ); if(mysql_num_rows($result1)==0) { ?> <center><div class="alert alert-success">No student attempted this test.</div> </center> <?php } else { ?> <table class="table table-striped"> <tr> <th>Student Name</th> <th>Email-ID</th> <th>Obtained Points</th> <th>Result(%)</th> </tr> <?php while($r1=mysql_fetch_array($result1)) { ?> <tr> <td><input type="text" value="<?php echo htmlspecialchars_decode($r1['stdname'],ENT_QUOTES);?> <?php echo htmlspecialchars_decode($r1['stdlastname'],ENT_QUOTES); ?>" name="std"</td> <td><input type="text" value="<?php echo htmlspecialchars_decode($r1['emailid'],ENT_QUOTES); ?>" name="em"/></td> <td><input type="text" value="<?php echo $r1['om']; ?>" name="om"/></td> <td><input type="text" value="<?php echo ($r1['om']/$r['maxmarks']*100)." %"; ?>" name="mm"/></td> </tr> </form> <?php } } } else { ?> <center> <div class="alert alert-success">Something went wrong. Please logout and Try again.</div></center> <?php } ?> </table> <input type="submit" name="submit" value="Download Excell File" class="btn btn-success" /> </form> <?php } else { /************************** Step 3 - Case 2 *************************/ // Defualt Mode: Displays the Existing Test Results, If any. $result=executeQuery("select t.testid,t.testname,DATE_FORMAT(t.testfrom,'%d %M %Y') as fromdate,DATE_FORMAT(t.testto,'%d %M %Y %H:%i:%S') as todate,sub.subname,(select count(stdid) from studenttest where testid=t.testid) as attemptedstudents from test as t, subject as sub where sub.subid=t.subid and t.tcid=".$_SESSION['tcid'].";"); if(mysql_num_rows($result)==0) { ?> <center> <div class="alert alert-success">There is no examination yet.</div> </center> <?php } else { $i=0; ?> <table class="table table-striped"> <tr> <th>Test Name</th> <th>Validity</th> <th>Subject Name</th> <th>Attempted Students</th> <th>Details</th> </tr> <?php while($r=mysql_fetch_array($result)) { $i=$i+1; if($i%2==0) { echo "<tr class=\"alt\">"; } else { echo "<tr>";} echo "<td>".htmlspecialchars_decode($r['testname'],ENT_QUOTES)."</td><td>".$r['fromdate']." To ".$r['todate']." PM </td>" ."<td>".htmlspecialchars_decode($r['subname'],ENT_QUOTES)."</td><td>".$r['attemptedstudents']."</td>" ."<td class=\"tddata\"><a title=\"Details\" href=\"rsltmng.php?testid=".$r['testid']."\"><img src=\"../images/detail.png\" height=\"30\" width=\"40\" alt=\"Details\" /></a></td></tr>"; } ?> </table> <?php } } closedb(); } ?> I NEED TO EXPORT STUDENTNAME,LASTNAME EMAILID , OBTAINED POINTS ['om'] and maxmarks ['maxmarks'] Can you please give me a script to export those ? PLEASE