954,585 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

PHP and Crystal Reports

Hi! I'm having a problem when generating a crystal report from php. This code works fine when not using connections to ODBC, but when I try to connect i get the error: "Server has not yet been openned". I've tried almost everything, even chaging the dlls but nothing has worked already!

I'm working with crystal reports 8.5, SQL server 2005 through DSN.

Any help is truly appreciated

<?php

$COM_Object = "CrystalRunTime.Application";
$my_report = "C:\\test_dat.rpt";
$my_pdf = "C:\\test.pdf";

$crapp= New COM($COM_Object) or die("Unable to Create Object");
$creport = $crapp->OpenReport($my_report, 1);

$creport->ExportOptions->DiskFileName=$my_pdf;
$creport->ExportOptions->PDFExportAllPages=true;
$creport->ExportOptions->DestinationType=1; // Export to File
$creport->ExportOptions->FormatType=31; // Type: PDF

$creport->ReadRecords();

$creport->Export(false);



/* Format Types:

4 - RTF
31 - PDF
30 - xls
36 - xls
14 - doc

*/
?>
andrew850101
Newbie Poster
1 post since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You