1

Topic: call to non object in php 5.0.5 when using common.php

I used this from the docs to try and get the objects needed to integrate:

define('PUN_ROOT', './forums/');
require PUN_ROOT.'include/common.php';

Once you've included common.php, you can access and utilize all of PunBB's global variables and functions. Typically, you will be most interested in the $pun_user array. This array holds information about the current user. Another interesting variable is the database object $db.

But keep getting an error that $db is not an object in functions.php.

php 5.0.5

Is this a bug or just improper usage on my part?

Re: call to non object in php 5.0.5 when using common.php

If you are just using the $db variable in the script it should be fine and you should be getting no errors. However, if you are using the variable inside a function you need to declare $db as a global before it will recognise it.

I don't HAVE a signature, ok?

3

Re: call to non object in php 5.0.5 when using common.php

Got it! I just saw that in another thread.

thanks!

But I have a question in the same line. I get everything but the common.php array values. If I call the index.php then the common.php values die even though the path to the file is correct. So the page shows E where the value should be in the forum table.