this time i have a hard problem. I have:
[folder] (file)
Structure directory
[class]
- (class.page.php)
- (class.main.php)
[core]
- (core.test.php)
Now class.data.php
<?php
class DataTools {
public function clean($string) {
if (!empty($string)) {
$string = addslashes($string);
$string = mysql_real_escape_string($string);
$string = (string)$string;
$string = stripslashes($string);
$string = str_replace(" ", "", $string);
$string = str_replace("(", "", $string);
$string = str_replace("=", "", $string);
return $string;
} else {
echo "Error";
die();
}
}
Now class.page.php
<?php
class Page {
public function __construct {
include "class.data.php";
$data = New DataTools();
}
?>
Now core.test.php
<?php
require_once "../class/class.page.php";
$page = new Page;
$nome = $data->clean("exemple"); // line 13
?>
When i open class.test.php it display this: Fatal error: Call to a member function clean() on a non-object in /membri/khchapterzero/core/core.test.php on line 13( this is not important becouse i reduced the page for the topic, but the line in the original page was that i posted, the other line was comments)