Click to See Complete Forum and Search --> : Check DB connection state
Memnoch1207
Apr 8th, 2003, 03:16 PM
Does anyone know how I can check the state of the db connection?
In asp it would be something like this
if(conn.state = 1) then
end if
how would this be done in php?
my DB_DSN looks like this
define('DB_DSN', 'pgsql://phptest:test@frink.intruos.com/phptest');
phpman
Apr 9th, 2003, 10:46 AM
echo connection_status();
will tell you the connection state.
and what is this
define('DB_DSN', 'pgsql://phptest:test@frink.intruos.com/phptest');
all you did was assign a variable that equals
'pgsql://phptest:test@frink.intruos.com/phptest'
how is that helping?
Memnoch1207
Apr 9th, 2003, 02:48 PM
yes, I defined a variable that holds my connectionString to the database. It's like assigning the Application("ConnectionString") in a global.asa in asp.
that way all I have to do is
// connects to database
$db = DB::connect(DB_DSN);
// querys the database
$getRecords = $db->query('SELECT * FROM tablename');
// closes connection
$db->disconnect();
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.