note 27251 modified in function.mysql-select-db by betz

From: Date: Sat, 21 Jun 2003 21:43:21 +0000
Subject: note 27251 modified in function.mysql-select-db by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-50797@lists.php.net to get a copy of this message
<?php $connection = mysql_connect($host, $user, $pass); $db = mysql_select_db($mydatabase, $connection); ?> The second paremeter in mysql_select_db is if you defined more than one mysql_connect(). You should *always* define it, even if you only have one connection, as it is good practice, and will prevent confusion later if you want to add another connection. P.S. The first part of my e-mail (before @) is rot_13 encoded! Armond --was-- The previous post was a bad example. Here is a better example, with the optional resource parm: <?php $connection = mysql_connect($host, $user, $pass); $db = mysql_select_db($mydatabase, $connection); ?> The second paremeter in mysql_select_db is if you defined more than one mysql_connect(). You should *always* define it, even if you only have one connection, as it is good practice, and will prevent confusion later if you want to add another connection. P.S. The first part of my e-mail (before @) is rot_13 encoded! Armond http://www.php.net/manual/en/function.mysql-select-db.php

« previous php.notes (#50797) next »