Server IP : 108.170.25.35 / Your IP : 3.15.26.135 Web Server : Apache/2 System : Linux gains.winzonesoftech.com 4.18.0-513.24.1.el8_9.x86_64 #1 SMP Mon Apr 8 11:23:13 EDT 2024 x86_64 User : softechwinzone ( 1579) PHP Version : 8.1.28 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/softechwinzone/domains/winzonesoftech.in/private_html/admin/ |
Upload File : |
<?php // Load the database configuration file include_once 'connect.php'; // Filter the excel data function filterData(&$str){ $str = preg_replace("/\t/", "\\t", $str); $str = preg_replace("/\r?\n/", "\\n", $str); if(strstr($str, '"')) $str = '"' . str_replace('"', '""', $str) . '"'; } // Excel file name for download $fileName = "intern_" . date('Y-m-d') . ".xls"; // Column names $fields = array('S.No', 'FIRST NAME', 'LAST NAME', 'PHONE', 'EMAIL', 'AGE','CITY','DISTRICT','COMPANY NAME','DESIGNATION','EX.EMPLOYMENT','JOB SEEKER', 'DEGREE','PASSED OUT','STUDENT ID','COURSE NAME','INTERNSHIP COURSE','NO.OF STUDENTS','MESSAGE', 'SUBMITTED DATE'); // Display column names as first row $excelData = implode("\t", array_values($fields)) . "\n"; // Fetch records from database $query = mysqli_query($conn,"SELECT * FROM internship ORDER BY id DESC"); if($query->num_rows > 0){ // Output each row of the data $i=1; while($row = $query->fetch_assoc()){ // $status = ($row['status'] == 1)?'Active':'Inactive'; $lineData = array($i, $row['fname'], $row['lname'], $row['phone'], $row['email'], $row['age'], $row['city'], $row['district'], $row['companyname'], $row['disignation'], $row['employex'], $row['jobseeker'], $row['degree'], $row['passtout'], $row['studentid'], $row['coursename'], $row['internshipname'], $row['nuofstudents'], $row['message'], $row['date']); array_walk($lineData, 'filterData'); $excelData .= implode("\t", array_values($lineData)) . "\n"; $i++; } }else{ $excelData .= 'No records found...'. "\n"; } // Headers for download header("Content-Type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=\"$fileName\""); // Render excel data echo $excelData; exit;