require_once('DB.php') failure

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I'm using a relatively simple php script to query a mySQL database and
return values formatted to a variable string for interpretation by an
embedded swf.  There is one php file that handles the connection to the
db (db_login.php) and one that handles the query (db_getProjects.php).
If I call up the db_getProjects.php file it simply spits back a
"&varibale=value..." blah blah string.  The problem is that it works
only half the'll be fine for a while then simply stop working
at all for a while...then start working again.  When it isn't working
it is failing to even get past the require_once('DB.php') statement -
anything after that is never reached.

What could I be doing that is causing the require_once('DB.php') to
fail after working flawlessly for stretches?

note: I am making sure to close the connection at the end of each DB
call, so I don't think its due to open DB connections piling up, though
that seems to be the only logical answer.


Re: require_once('DB.php') failure

that can have any number of reasons. it's impossible to tell from your
description. can't even say wether this is a mysql or a php problem.

what comes to mind is:
1. error_reporting(E_ALL) at the top of your script will print out any
php errors
2. check mysql_error() after any query
3. post error messages here


Re: require_once('DB.php') failure

I've added the error_reporting(E_ALL) and it didn't show me anything.
I've had the mysql_error() check after each DB call and they've yet to
return an error.  When the script fails I just see nothing.  If I drop
in an echo statement before the require_once('DB.php') call it comes
through, but anything after doesn't.  Below is the code...

$username = 'xxxxxx';
$password = 'xxxxxx';
$hostspec = '';
$database = 'xxxxxxDB';
$phptype = 'mysql';
$dsn =
$db = DB::connect($dsn);

$sql = "SELECT * FROM Projects ORDER BY County";
$q = $db->query($sql);
$varList = "";
//CONSTRUCT VARIABLE LIST------------------------
while ($row = $q->fetchRow(DB_FETCHMODE_OBJECT)){
    $varList .= $row->County."^".$row->Title."^".$row->Link."^^";
echo '&projects='.rtrim($varList,'^');

Re: require_once('DB.php') failure

Since this always hung up when loading the PEAR db include, I decided
to ditch PEAR and go with straight mySQL calls and the problem went

Site Timeline