note 68896 added to function.mysql-connect

From: Date: Tue, 15 Aug 2006 10:37:44 +0000
Subject: note 68896 added to function.mysql-connect
Groups: php.notes 
Request: Send a blank email to php-notes+get-115927@lists.php.net to get a copy of this message
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 ---- Server IP: 193.190.198.20 Probable Submitter: 62.205.106.110 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-connect.php Edit -- https://master.php.net/note/edit/68896 Del: integrated -- https://master.php.net/note/delete/68896/integrated Del: useless -- https://master.php.net/note/delete/68896/useless Del: bad code -- https://master.php.net/note/delete/68896/bad+code Del: spam -- https://master.php.net/note/delete/68896/spam Del: non-english -- https://master.php.net/note/delete/68896/non-english Del: in docs -- https://master.php.net/note/delete/68896/in+docs Del: other reasons-- https://master.php.net/note/delete/68896 Reject -- https://master.php.net/note/reject/68896 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#115927) next »