note 68896 deleted from function.mysql-connect by nlopess
| From: | nlopess@php.net | Date: | Tue, 15 Aug 2006 11:27:35 +0000 |
| Subject: | note 68896 deleted from function.mysql-connect by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-115928@lists.php.net to get a copy of this message | ||
Note Submitter: info put at sign instead vacilando org
----
This took me a full day of trial and error... hope it will help somebody.
I intended to define two MySQL database connections, way at the beginning, in some initialization
file:
<?
$mysql_connected['vacilando_db1'] = mysql_connect( $mysql_server, $mysql_user, $mysql_pass
);
$mysql_connected['vacilando_db2'] = mysql_connect( $mysql_server, $mysql_user, $mysql_pass
);
?>
and then later access them everywhere using e.g.:
<?
$data = mysql_query( $query, $GLOBALS['mysql_connected']['vacilando_db1'] );
?>
This does not work! Even if using mysql_pconnect() it does not work. Somehow, at least on my php v.
5.1.4., before mysql_query() I always need to use:
<?
mysql_select_db( "vacilando_db1",
$GLOBALS['mysql_connected']['vacilando_db1'] )
?>
Why? PHP knows!
Cheers,
Tomáš / http://www.vacilando.org