Results 1 to 2 of 2

Thread: Class Problem/mysql :(

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Belgium
    Posts
    167

    Angry Class Problem/mysql :(

    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.

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Class Problem/mysql :(

    From a quick examination of the code you have posted (please use [php][/php] 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.

    To get rid of your nasty error, ensure that all PHP code is enclosed within <?php ?> and not <? ?>.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width