| Current Path : /var/www/html/venkat/project1/ |
| Current File : /var/www/html/venkat/project1/hexcelprojectview.php |
<?php
mysql_connect("localhost","project","w3bproject") or die(mysql_error());
mysql_selectdb("upload") or die(mysql_error());
$option1 = addslashes($_POST['option1']);
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename='.$option1.'.csv');
$output = fopen('php://output', 'w');
$k1 = substr($option1,0,8);
$k2 = substr($option1,9,9);
if($option1=="Faculty") {
}
if($k1=="semester")
{
$quer1=mysql_query("select discipline, projectid, rollno, name, guide, title, verified, accepted from projectsubmit where semester='$k2' order by projectid") or die("Invalid Access3 !!!");
fputcsv($output, array('Dept','Project-Id','Roll No.','Name','Guide','Title', 'Verified', 'Accepted'));
while($row = mysql_fetch_assoc( $quer1 )) {
fputcsv($output, $row);
}
}
if($option1=="projectid") {
}
if($option1 == "verified") {
fputcsv($output, array('Dept','Semester','Project Id','Roll No.','Name','Date of Creation','Verified'));
$quer1=mysql_query("select discipline, semester, projectid, rollno, name, date, verified from projectsubmit where verified='no' order by rollno") or die("Invalid Access3 !!!");
while($row = mysql_fetch_assoc( $quer1 )) {
fputcsv($output, $row);
}
}
if($option1 == "pending") {
fputcsv($output, array('Dept','Semester','Project Id','Roll No.','Name','Date of Creation'));
$quer1=mysql_query("select discipline, semester, projectid, rollno, name, date from projectsubmit where accepted='n' order by projectid") or die("Invalid Access3 !!!");
while($row = mysql_fetch_assoc( $quer1 )) {
fputcsv($output, $row);
}
}
if($option1 == "rejected") {
fputcsv($output, array('Dept','Semester', 'Project Id','Roll No.','Name'));
$quer1=mysql_query("select discipline,semester,projectid,rollno,name from projectsubmit where accepted='1' order by projectid") or die("Invalid Access3 !!!");
while($row = mysql_fetch_assoc( $quer2 )){
fputcsv($output, $row);
}
}
if($option1=="submitted") {
fputcsv($output, array('Dept','Semester', 'RollNo','Name'));
$query = mysql_query("SELECT Table2.dept,Table2.semester,Table2.rollno,Table2.name FROM projectstudent Table2 where Table2.rollno not in (SELECT rollno FROM projectsubmit T1) order by Table2.rollno") or die("Invalid Access");
//$result=mysql_query($query)or die("Invalid Access1 !!!");
//$num=mysql_numrows($result);
//$i=0;
while($row = mysql_fetch_assoc( $query )){
fputcsv($output, $row);
}
/* while ($i < $num) {
fputcsv($output, $row);
$i++;
}*/
}
?>