[TYPO3-dev] non typo3 Database Selection error !!

R. van Twisk typo3 at rvt.dds.nl
Sat Jan 6 13:37:43 CET 2007


Martin Kutschker wrote:
> nirmalya Mondal schrieb:
>   
>> Hello,
>> In my own extension its needed to select another database that is not 
>> typo3 database. For this i've written this code
>> ---------------
>>  function databaseConnection(){
>>
>>         $extnConf = 
>> unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['fivee_oscommerce']); 
>>
>>         $host         = $extnConf[db_host];
>>         $user         = $extnConf[db_user];
>>         $password     = $extnConf[db_password];
>>         $dbasename     = $extnConf[db_name];
>>         $connDb = @mysql_connect($host,$user,$password)or die('Not 
>> Connected:' .mysql_error());
>>                
>>        
>>             $selectDb = mysql_select_db($dbasename,$connDb) or 
>> die('Database selection Failed' .mysql_error());
>>                    
>>     }   
>>
>> ERROR:
>> Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL 
>> result resource in /myWebDirectory/t3lib/class.t3lib_db.php on line 802
>> -----------------
>> when i've commented out
>> "//$selectDb = mysql_select_db($dbasename,$connDb) or die('Database 
>> selection Failed' .mysql_error());" this line no error message is 
>> displaying.
>> This extension is generating its output properly.
>>     
>
> What do you want to do? Are you trying to access your DB via the 
> routines of t3lib_db? If so, study the class and see how the connection 
> should be established. Hint: the class stores the connection resource.
>
> Masi
>   

-- 
Ries van Twisk
Freelance Typo3 Developer
=== Private:
email: ries at vantwisk.nl
web:   http://www.rvantwisk.nl/freelance-typo3.html
skype: callto://r.vantwisk






More information about the TYPO3-dev mailing list