In the index.php file I have the following code:
require_once('include/db_connect.php'); require_once('include/db_functions.php');
/* includes commonly used functions */ require_once('common.php');
$sphist_rec_count = GetRecCount('RecentActiveSpaces','RECENT_SPACE_COUNT');
In my db_functions.php, I have the function called GetRecCount(). It
basically retrieves the
Record count from a mySQL table. For some reason, the "db_object" object
doesn't get created unless I include the db_connect.php inside the GetRecCount function. Something
This sounds like a problem with your PEAR::DB object's scope. Without more information about your db_connect file it's hard to say exactly what's wrong. However, you if you go to this page you should be able to figure out what's wrong:
http://www.zend.com/manual/language.variables.scope.php
tells me that this is not proper Coding, and I was wondering if someone could tell me if there is another way to do this?
common.php: require_once 'include/db_functions.php'; require_once 'include/db_connect.php';
index.php: require_once 'common.php';
Now any file that uses common.php will have access to db_connect.php and db_functions.php
Thanks, Jim
-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php