Re: PHP-MySQL connection for particular module

From: Date: Thu, 19 Jun 2008 07:12:54 +0000
Subject: Re: PHP-MySQL connection for particular module
References: 1 2 3 4 5  Groups: php.db 
Request: Send a blank email to php-db+get-45089@lists.php.net to get a copy of this message
My mistake then, it's been a while that I used it that way so some things do fade away from my mind. On Thu, Jun 19, 2008 at 1:57 AM, Chris <dmagick@gmail.com> wrote: > Isaak Malik wrote: > > Because then the connection resource isn't stored in the $link variable > > and you will be able to use the mysql functions without passing that > > variable to each function. > > RTM again. > > The link parameter is completely optional. > > If you don't specify it, it uses the last connection created. > > I can do this and it's perfectly valid: > > $link = mysql_connect($server, $user, $pass); > if (!$link) { > die ("Unable to connect to the database server"); > } > > $db_selected = mysql_select_db($databasename); > if (!$db_selected) { > die("Unable to connect to the database $databasename"); > } > > $result = mysql_query("select 1"); > > -- > Postgresql & php tutorials > http://www.designmagick.com/ > -- Isaak Malik Web Developer

« previous php.db (#45089) next »