Re: PHP-MySQL connection for particular module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux