Location: PHPKode > projects > ERPSOD > erpsod/exp_ta_tr.php
<?PHP
include_once("config.php");
$ok=role_check();
if (!$ok){
	header("Location: login.php"); 
}
$sql=" select taskname,taskdesc,transname,transdesc from erptask,erptrans,tasktrans where tasktrans.taskid=erptask.taskid and tasktrans.transid=erptrans.transid order by taskname,transname";
$result = mysql_query($sql) or die(mysql_error());
// Put the name of all fields
$out  = "Task";
$out .= ",";
$out .= "Description";
$out .= ",";
$out  = "Transaction";
$out .= ",";
$out .= "Description";
$out .="\n";
// Add all values in the table
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
	$out .= "$row[0]" ;
	$out .= ",";
	$out .= trim("$row[1]");
	$out .= ",";
	$out .= trim("$row[2]" );
	$out .= ",";
	$out .= trim("$row[3]");
	$out .="\n";
}
// Output to browser
header('Content-type: text/richtext');
header("Content-Disposition: attachment; filename=tasks_transaction_exported.csv");
echo $out;
Return current item: ERPSOD