|
-
Apr 8th, 2003, 03:16 PM
#1
Thread Starter
Frenzied Member
Check DB connection state
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
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Apr 9th, 2003, 10:46 AM
#2
Frenzied Member
echo connection_status();
will tell you the connection state.
and what is this
define('DB_DSN', 'pgsql://phptest:[email protected]/phptest');
all you did was assign a variable that equals
'pgsql://phptest:[email protected]/phptest'
how is that helping?
-
Apr 9th, 2003, 02:48 PM
#3
Thread Starter
Frenzied Member
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
PHP Code:
// connects to database
$db = DB::connect(DB_DSN);
// querys the database
$getRecords = $db->query('SELECT * FROM tablename');
// closes connection
$db->disconnect();
Last edited by Memnoch1207; Apr 9th, 2003 at 03:01 PM.
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|