Re: connecting to mysql db

From: Date: Tue, 25 Mar 2003 14:41:39 +0000
Subject: Re: connecting to mysql db
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-140962@lists.php.net to get a copy of this message
At 14:49 25-3-2003, you wrote:
hi, I am trying to play and learn php along with mysql and I have a question about connecting to a db. Is the following code necessary on every php page where I am retrieving some data from a db or is there any way to connect once (something like index.php) and have that connection open through subsequent pages? the code <?php $link = mysql_connect("localhost", "", "")
        or die("Could not connect: " . mysql_error());
    print ("Connected successfully");
mysql_select_db("test")
        or die("Could not select database: " . mysql_error());
?> maybe you are looking for: http://www.php.net/manual/en/function.mysql-pconnect.php


« previous php.general (#140962) next »