[Typo3-dev] Connecting to a different db kills typo3 db connection?

Dmitry Dulepov typo3 at fm-world.ru
Sun Jul 31 22:01:53 CEST 2005


Hi!

I am trying to connect to a different mysql database from my extension.
Code is similar to:

---------------------
$rc = mysql_connect('localhost', 'aaa', 'bbb', true);
mysql_select_db('ccc', $rc);
$res = mysql_query('SELECT * FROM something WHERE name=\'' .
	mysql_real_escape_string($userId, $rc) . '\'', $rc);
if (false !== $res) {
	$this->rec = mysql_fetch_assoc($res);
	mysql_free_result($res);
}
mysql_close($rc);
---------------------

As you see I am creating a new link (last parameter to mysql_connect),
so it should not interfer with any other database connection. However,
any extension, that uses TYPO3_DB after my extension, looses database
connection when the code above is executed. If I replace the last line
(mysql_close) with mysql_select_db('typo3db_name', $rc) than everything
works fine!

The code above is located in a separated function, no global variables
are used.

Is this a bug? I am using version 3.7.0 with PHP 4.3.11 and MySQL 3.23.
Typo3 uses mysql_pconnect.

Dmitry.




More information about the TYPO3-dev mailing list