hi,
I'm working with this project, since i'm not good at programming I'm facing a problem in adding a new function. I'm trying to download the content i.e. the ticket inforamtion. but I'm failed. to do so. what i'm doing is i have putted the following code in ticket.inc.php.
<? // session_start() ; ?>
">
Date Span:
From
"
autocomplete=OFF />
to
" autocomplete=OFF />
and created a new page colled export.php and saved this page in scp folder.
require('staff.inc.php');
require_once(INCLUDE_DIR.'class.ticket.php');
require_once(INCLUDE_DIR.'class.dept.php');
require_once(INCLUDE_DIR.'class.banlist.php');
$startDate = $_REQUEST;
$endDate =$_REQUEST;
$qselect = 'SELECT ticketID,ticket.created,subject,dept_name,name,email,source,ticket.ticket_id,ticket.dept_id,ticket.staff_id '.
',status,isoverdue,pri.* ';
$qfrom=' FROM '.TICKET_TABLE.' ticket LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id '.
' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON ticket.priority_id=pri.priority_id '.
' LEFT JOIN '.TICKET_LOCK_TABLE.' tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() ';
$qwhere="WHERE ticket.created BETWEEN str_to_date('$startDate', '%m/%d/%Y/%h/%m/%s') AND str_to_date('$endDate', '%m/%d/%Y/%h/%m/%s') " ;
$qgroup=' GROUP BY ticket.ticket_id';
$query="$qselect $qfrom $qgroup ";
//$query=" SELECT ticket.ticket_id,ticketID,subject,name,email,department.dept_name FROM".TICKET_TABLE.",".DEPT_TABLE."";
//echo $query;
$result = mysql_query($query);
$i = 0;
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
$csv_output .= $row.", ";
$i++;
$csv_output ="Ticket,Date,Subject,Department,Name,Satus,Email ";
}}
$csv_output .= "\n";
$values = mysql_query($query);
while ($rowr = mysql_fetch_row($values)) {
for ($j=0;$j<$i;$j++) {
$csv_output .= $rowr.", ";
}
$csv_output .= "\n";
}
$filename = $file."_".date("Y-m-d_H-i",time());
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: csv" . date("Y-m-d") . ".csv");
header( "Content-disposition: filename=".$filename.".csv");
print $csv_output;
exit;
?>
Now I'm able to get the .csv file with the detail. But now the problem is When user want to save a file after search or only from some department then this code is not working. can any one please help me in creating this.