remove connection, what does application do

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
johnhelen
Forum Commoner
Posts: 45
Joined: Mon Feb 19, 2007 9:17 pm

remove connection, what does application do

Post by johnhelen »

I have a code

Code: Select all


<?
  pg_connect("dbname=mydb user=myuser");
  $myresult = pg_exec("SELECT * FROM id,username,fname,lname where id > 100");
?>
Any problem if I remove the first line pg_connect("dbname=mydb user=myuser") and now I only have

Code: Select all

<?
  $myresult = pg_exec("SELECT * FROM id,username,fname,lname where id > 100");
?>
I know that I will have $myresult = null but I want to know what will happen. Does the application slow down as it looks for a database connection? Does it throw an error?

Many thanks
john
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: remove connection, what does application do

Post by John Cartwright »

I hate to say this ever, but this can be easily answered by yourself if you simply tried it. Just make sure you have display_errors enabled and your error reporting set to atleast E_ALL.

I.e.,

Code: Select all

ini_set('display_errors', true);
error_reporting(E_ALL);
Post Reply