Problem with Include (newb question)

Problem with Include (newb question)

am 07.11.2007 15:53:14 von Phillip Taylor

I'm new to PHP and I'm having problems trying to get this include
statement to work. Can anyone help me?

This is the error I get:

Warning: include() [function.include]: Failed opening '' for inclusion
(include_path='.:/php/includes') in /home/ptaylor/public_html/am_web/
model/classes/customer.php on line 3

This is the contents of the customer.php file:


include(realpath('../interfaces/tableobject.php')); #<---
THIS IS LINE 3, WHERE THE ERR IS REPORTED

class Customer implements TableObject
{
public $Id;
public $Name;
public $Comments;
public $Deleted;

public $Children; #Children are Regions
public $Rights;

#Customer Constructor.
public function __construct($id)
{

parent::__construct();

$this->Id = $id;
}

public function GetTableName()
{
return "customer";
}

public function GetTableId()
{
return $this->Id;
}

public function GetChildren()
{
return $this->Children;
}

public function GetRights()
{
return $this->Rights;
}

public function GetTreeText()
{
return $this->Name;
}
}

?>

The file is DEFINETELY 100% in that location. If I do cd ../
interfaces/ there is a file there called tableobject.php

the contents of that file is this:


#Represents an object that lives in the database.

public interface TableObject
{
function GetTableName();
function GetTableId();
function GetChildren();
function GetRights();
}

?>

Can anyone help? Is the include statement in the wrong place?

Phill

Re: Problem with Include (newb question)

am 07.11.2007 16:12:49 von Phillip Taylor

On Nov 7, 2:53 pm, Philluminati wrote:
> I'm new to PHP and I'm having problems trying to get this include
> statement to work. Can anyone help me?
>
> This is the error I get:
>
> Warning: include() [function.include]: Failed opening '' for inclusion
> (include_path='.:/php/includes') in /home/ptaylor/public_html/am_web/
> model/classes/customer.php on line 3
>
> This is the contents of the customer.php file:
>
> >
> include(realpath('../interfaces/tableobject.php')); #<---
> THIS IS LINE 3, WHERE THE ERR IS REPORTED
>
> class Customer implements TableObject
> {
> public $Id;
> public $Name;
> public $Comments;
> public $Deleted;
>
> public $Children; #Children are Regions
> public $Rights;
>
> #Customer Constructor.
> public function __construct($id)
> {
>
> parent::__construct();
>
> $this->Id = $id;
> }
>
> public function GetTableName()
> {
> return "customer";
> }
>
> public function GetTableId()
> {
> return $this->Id;
> }
>
> public function GetChildren()
> {
> return $this->Children;
> }
>
> public function GetRights()
> {
> return $this->Rights;
> }
>
> public function GetTreeText()
> {
> return $this->Name;
> }
>
> }
>
> ?>
>
> The file is DEFINETELY 100% in that location. If I do cd ../
> interfaces/ there is a file there called tableobject.php
>
> the contents of that file is this:
>
> >
> #Represents an object that lives in the database.
>
> public interface TableObject
> {
> function GetTableName();
> function GetTableId();
> function GetChildren();
> function GetRights();
>
> }
>
> ?>
>
> Can anyone help? Is the include statement in the wrong place?
>
> Phill

Don't worry fixed it :-)