2

I have two php files in the same directory:

test.tattler.php
class.tattler_stats.php

My test.tattler is supposed to create an object of my tattler_stats but it gives me this error:

Fatal error: Class 'tattler_stats' not found in /.../test.tattler.php on line 4

Code in test.tattler:

<?php

include 'class.tattler_stats.php';

$tattler_test = new tattler_stats( $_REQUEST );

?>

The code in tattler_stats:

function __construct( $_REQUEST )
{
    $param = $_REQUEST['menu'];

    run();
}

function run()
{
    connect();
    showMenu( $parm ) ;
//rest of class...

1 Answer 1

1

make sure you're actually declaring the class in your class file

class tattler_stats {
    // class code here
}

if you are already doing that, try specifying the path more concretely:

include(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'class.tattler_stats.php');
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.