0

Trying to deploy Crystal Report to PHP, but facing some error as below:

Parse error: syntax error, unexpected '$creport' (T_VARIABLE) in C:\xampp....

Using XAMPP localhost, MYSQL and PHP.

Here is the code:

<?php

$my_report = "C:\\feeder_record.rpt"; // 

$my_pdf = "C:\\report.pdf"; 
$ObjectFactory= new COM("{00020906-0000-0000-C000-000000000046}") or die ("Error on load"); 
($crapp = $ObjectFactory-> CreateObject("CrystalDesignRunTime.Application") )
$creport = $crapp->OpenReport($my_report, "1");


$creport->Database->Tables(1)->SetLogOnInfo("localhost", "root", "", "record");


$creport->EnableParameterPrompting = 0;
$creport->DiscardSavedData;
$creport->ReadRecords();
$creport->ExportOptions->DiskFileName=$my_pdf; 
$creport->ExportOptions->PDFExportAllPages=true;
$creport->ExportOptions->DestinationType=1; 
$creport->ExportOptions->FormatType=31; 
$creport->Export(false);


$creport = null;
$crapp = null;
$ObjectFactory = null;

print "<embed src=\"report.pdf\" width=\"100%\" height=\"100%\">"
    
    
?>

Anyone can advise? Thanks in advance!

1o13
  • 11
  • 1
  • 5

1 Answers1

0

Update line number 7,

$crapp = $ObjectFactory-> CreateObject("CrystalDesignRunTime.Application") ;
Naga
  • 2,190
  • 3
  • 16
  • 21
  • Hi Naga. Yes if I update line 8 will come with another error, such as Fatal error: Call to undefined method com::CreateObject() in C:\xampp\..... – 1o13 Sep 21 '17 at 04:40