[TYPO3] Get connected to Typo3 Databes from an external php script

Dmitry Dulepov dmitry at typo3.org
Mon Jul 2 13:32:32 CEST 2007

Christian Leicht wrote:
> Sorry Dmitry this does not make sense for me. I use this functions in 
> the class.tx_myext_pi1.php
> But i must create a 2nd php script an on this file i need to connenct to 
> the Database. This file is not included in the T3 Framework. It just 
> grab Ajax informations from the Browser and give Public infos back.

Well, you stated that you want to use something like:

$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
     $test[] = $row['uid'];

It means that you must have:
- database parameters from localconf.php
- class from t3lib/class.t3lib_db.php (this is where exec_SELECTquery is 
- something to initialize this class
- something to check whether records are not deleted/hidden
- possibly check for some security???

The first three steps can be done with include of two files. But this 
neither secure, nor conforms to typo3 standards. So you have to go with 
eID *if* you want to do it properly. If you do not care - just include 
those two files and use them on your own risk.

Dmitry Dulepov
TYPO3 freelancer / TYPO3 core team member
Web: http://typo3bloke.net/
Skype: callto:liels_bugs

More information about the TYPO3-english mailing list