PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am new to PHP and working on table updation. My company has its own style of writing the code. I am getting a blank page on including this file. On using a debugger. i got parse error: unexpected $
<?
//////////////////////////////////////////////
// PrintInv Class
// Represents the date of print invoices
/////////////////////////////////////////////
require_once ("$inc_path/db/db_record.inc");
require_once ("$inc_path/db/clinic.inc");
require_once ("$inc_path/db/patient.inc");
require_once ("$inc_path/db/purchase.inc");
require_once ("$inc_path/transaction.inc);
class PrintInv extends DBRecord {
var $patient;
var $clinic;
var $purchase;
var $transaction;
//////////////////////////////////////////
// CONSTRUCTOR
// called when new object is instantiated
/////////////////////////////////////////
function PrintInv($id=0) {
$this->DBRecord('invoice_print', 'inv_id', $id);
/////////////////////////////////////////////////////////////////////////////
//where invoice_print is the new table to store current date .
//patient_id, clinic_id and purchase_id are the foreign keys in this table
////////////////////////////////////////////////////////////////////////////
//Patient constructor is called
if ($this->get('patient_id')) {
$this->patient = new Patient($this->get('patient_id'));
if (!$this->patient->get('patient_name')) {
$this->patient = 0;
}
}
//Clinic constructor is called
if ($this->get('clinic_id')) {
$this->clinic = new Clinic($this->get('clinic_id'));
if (!$this->clinic->get('clinic_name')) {
$this->clinic = 0;
}
}
//Purchase constructor is called
if ($this->get('purchase_id')) {
$this->purchase = new Purchase($this->get('purchase_id'));
if (!$this->purchase->get('purchase_type')) {
$this->purchase = 0;
}
}
//Transaction constructor is called
if ($this->get('transaction_no')) {
$this->transaction = new Transaction($this->get('transaction_no'));
}
}
function storeNew() {
$this->set('invoice_no', this->transaction->get('invoice_no'));
$this->set('print_date', date('Y-m-d'));
$id = parent::storeNew();
return $id;
}
}
?>
I have no idea what am i doing wrong. Any help will be appreciated.
I have to access the invoice_no field and transaction class (NOT a database class) is used as a handy container for some of the common fields. That is why i am using an object of transaction class and setting the invoice_no accordingly. Do you think that accessing the invoice_no this way is incorrect. "invoice_no" field is also present in purchase table, Is there any other way to do it.
Hey kuhlpal, can you do a favor for me? Go back to your first post and change the [syntax=php]tags to[/syntax][syntax=php].
And post the ENTIRE error message, not just part of it.
With those two things done the problem should become clear.[/syntax]
Can anyone tell me what are the reasons of getting a blank page for .php file. I am including one file into existing .php file and due to the new include i am getting a blank page. I have checked that there is no syntax error in the include file. According to me the logic is also correct. Is there any other possible error?
Also, my php.ini file should have following setting:
* error_reporting = E_ALL
My Mistake!! The problem was with syntax, i was missing the parenthesis in include_once statement. However, the debugger was unable to detect the error. I am not getting that blank page anymore.