Re: [PHP-DB] PHP-MySQL connection for particular module
[email protected] (Chris)
| Newsgroups | php.db |
|---|---|
| Message-ID | <[email protected]> |
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/