} else {
    F_display_db_error();
}
$pdf->lastpage(true);
$pdf->SetAutoPageBreak(false);
$pdf->SetFont('helvetica', '', 5);
$pdf->SetTextColor(0, 127, 255);
$msg = "Powered by TCExam (www.tcexam.org)";
$lnk = "http://www.tcexam.org";
$pdf->SetXY(15, $pdf->getPageHeight(), true);
$pdf->Cell(0, 0, $msg, 0, 0, 'R', 0, $lnk, 0, false, 'B', 'B');
// set PDF file name
switch ($expmode) {
    case 1:
        $pdf_filename = 'tcexam_subject_' . $subject_id . '_' . date('YmdHi') . '.pdf';
        break;
    case 2:
        $pdf_filename = 'tcexam_module_' . $module_id . '_' . date('YmdHi') . '.pdf';
        break;
    case 3:
        $pdf_filename = 'tcexam_all_modules_' . date('YmdHi') . '.pdf';
        break;
    default:
        $pdf_filename = 'tcexam_export_' . date('YmdHi') . '.pdf';
        break;
}
// Send PDF output
$pdf->Output($pdf_filename, 'D');
//============================================================+
// END OF FILE
//============================================================+
        $pdf->Cell($data_cell_width * 7 / 5, $data_cell_height, $cstr, 1, 0, 'R', 0);
        $cstr = F_formatFloat($columns['wrong']);
        if (in_array($row, $calcpercent)) {
            $cstr .= ' ' . F_formatPdfPercentage($columns['wrong'] / $usrtestdata['all']);
        }
        $pdf->Cell($data_cell_width * 7 / 5, $data_cell_height, $cstr, 1, 0, 'R', 0);
        $cstr = F_formatFloat($columns['unanswered']);
        if (in_array($row, $calcpercent)) {
            $cstr .= ' ' . F_formatPdfPercentage($columns['unanswered'] / $usrtestdata['all']);
        }
        $pdf->Cell($data_cell_width * 7 / 5, $data_cell_height, $cstr, 1, 0, 'R', 0);
        $cstr = F_formatFloat($columns['undisplayed']);
        if (in_array($row, $calcpercent)) {
            $cstr .= ' ' . F_formatPdfPercentage($columns['undisplayed'] / $usrtestdata['all']);
        }
        $pdf->Cell($data_cell_width * 7 / 5, $data_cell_height, $cstr, 1, 1, 'R', 0);
    }
}
$pdf->lastpage(true);
$pdf->SetAutoPageBreak(false);
$pdf->SetFont('helvetica', '', 5);
$pdf->SetTextColor(0, 127, 255);
$msg = "Powered by TCExam (www.tcexam.org)";
$lnk = "http://www.tcexam.org";
$pdf->SetXY(15, $pdf->getPageHeight(), true);
$pdf->Cell(0, 0, $msg, 0, 0, 'R', 0, $lnk, 0, false, 'B', 'B');
// Send PDF output
$pdf->Output('tcexam_user_results_' . $user_id . '_' . date('YmdHis') . '.pdf', 'D');
//============================================================+
// END OF FILE
//============================================================+