PDA

Click to See Complete Forum and Search --> : Class Problem/mysql :(


Teckniel
Aug 3rd, 2008, 10:14 AM
Hello.

I have a nasty problem that i can't seem to solve.
I have defined a class with all function, but when i call the class on a other page i get this error: Fatal error: Class 'building_catalog' not found in C:\wamp\www\Test\test1.php on line 3

if i test everything in phped i get no error with the debugger or the internal webserver.

Much smaler version of the original code:

test1.php
------------------------
<?php require_once("../Kernel Core/Engine Core.php");?>
<?php
$c = new building_catalog();
$c->building_add_db("test_building");
?>

Engine Core.php (only 1 function)
-----------------------------
<?php require_once("includes/database_commands.php");?>
<?
class building_catalog
{
function building_add_db($name)
{
mysql_query("INSERT INTO gebouwen (building_name) VALUES ('$name' )") or die(mysql_error());
}
}


hope anyone can help me out because its driving me mad that i cant find a sollution.

visualAd
Aug 3rd, 2008, 04:10 PM
From a quick examination of the code you have posted (please use tags next time), you appear to have omitted the processing instruction name from one of your code blocks in "Engine Core.php".

While there is an option to have PHP interpret <? ?> as code, it is not a default option and is considered bad practice as it may conflict with other processing instructions (e.g: <?xml). The debugger may be configured with this option enabled (you can check this with a call to phpinfo()) and search for short_open_tag (http://uk.php.net/manual/en/ini.core.php#ini.short-open-tag).

To get rid of your nasty error, ensure that all PHP code is enclosed within <?php ?> and not <? ?>.