Possible Duplicate:
Reference - What does this error mean in PHP?
In the following code, I created two functions that needs the same information. I'm using this script.
<?php
function get_cbMain_Query() {
define( 'Main_SERVER_ADDR', 'ip');
define( 'Main_SERVER_PORT', 25565);
define( 'Main_TIMEOUT', 1 );
// require bloginfo('template_url') . 'inc/avatars/MinecraftQuery.class.php';
require __DIR__ . '/mcQuery/MinecraftQuery.class.php';
// Display everything in browser, because some people can't look in logs for errors
Error_Reporting( E_ALL | E_STRICT );
Ini_Set( 'display_errors', true );
$Timer = MicroTime( true );
$Query = new MinecraftQuery( );
try
{
$Query->Connect( Main_SERVER_ADDR, Main_SERVER_PORT, Main_TIMEOUT );
}
catch( MinecraftQueryException $e )
{
$Error = $e->getMessage();
echo 'error. <br>'. $Error;
}
return $Query;
}
function get_cbTekkit_Query() {
define( 'Tekkit_SERVER_ADDR', 'ip');
define( 'Tekkit_SERVER_PORT', 25565);
define( 'Tekkit_TIMEOUT', 1 );
// require bloginfo('template_url') . 'inc/avatars/MinecraftQuery.class.php';
require __DIR__ . '/mcQuery/MinecraftQuery.class.php';
// Display everything in browser, because some people can't look in logs for errors
Error_Reporting( E_ALL | E_STRICT );
Ini_Set( 'display_errors', true );
$Timer = MicroTime( true );
$Query = new MinecraftQuery( );
try
{
$Query->Connect( Tekkit_SERVER_ADDR, Tekkit_SERVER_PORT, Tekkit_TIMEOUT );
}
catch( MinecraftQueryException $e )
{
$Error = $e->getMessage();
echo 'error. <br>'. $Error;
}
return $Query;
}
When using this script and do the following to call it (From a different page, this script is included in another)
$cbMain = get_cbMain_Query();
$cbTekkit = get_cbTekkit_Query();
Then I get:
Cannot redeclare class MinecraftQueryException in MinecraftQuery.class.php on line 5
I am new to classes ad objects in PHP and can't figure out why i can't call two functions and use them at the same time. Help please?