Re: mysql_pconnect - persistance scope?

From: Date: Wed, 10 Oct 2001 06:45:50 +0000
Subject: Re: mysql_pconnect - persistance scope?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-13183@lists.php.net to get a copy of this message
Good idea. However, the actual function is not needed. If you included this file, all source code within will be executed. By the nature of the whats going on, you only do it once per script. SECURITY ALERT: require("include/database.inc"); it would be better to place the include way out of reach of HTTP require("../include/database.inc"); -Jason Garber IonZoft.com At 04:34 PM 10/10/2001 +1000, Robert Gormley wrote:
Persistence is referring to the PHP engine holding open the mysql connection. I usually make an include file: define("HOST", "hostname"); define("USER", "user"); define("PASSWORD", "pw"); define("DATABASE", "db"); function dbConnect() {
        mysql_pconnect(HOST, USER, PASSWORD);
        mysql_select_db(DATABASE);
} and then in each page where db access is required: require("includes/database.inc"); dbConnect(); Rgds, Robert At 04:44 PM 9/10/2001 -0700, Youngie wrote:
I have a question about mysql_pconnect. I execute it in one file logon.php and successfully do some db queries, later on in another file xyz.php I do some other queries but they fail. It works OK if I repeat the mysql_pconnect() and the mysql_select_db() in that file, is the persistance only across a single script? i.e. do I have to do a pconnect for every php file that does db access? If I do, how do I store the original userid and password to make them global to all php scripts. If I don't then what could the problem be? Some kind of timeout? Thanks John.
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net


« previous php.db (#13183) next »