开发者

TYPO3: exec_SELECTquery with where clause

开发者 https://www.devze.com 2023-04-10 10:13 出处:网络
The following select returns an empty result set, although it shoudn\'t: $res = $GLOBALS[\'TYPO3_DB\']->exec_SELECTquery(\'*\', \'tx_xmluploader_xml_import_tree\', \'xml_import_id=\'.$xml_import_i

The following select returns an empty result set, although it shoudn't:

$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_xmluploader_xml_import_tree', 'xml_import_id='.$xml_import_id);

$xml_import_id is set. And it works if I remove the where clause..

Thanks


I still don't开发者_运维百科 understand why it doesn't work.. A simple workaround suggested by a coleague:

// select all from the db     
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_xmluploader_xml_import_tree');

while( $entry = $GLOBALS['TYPO3_DB']->sql_fetch_assoc() )
{  
   if( $entry['xml_import_id'] == $xml_import_id ) {
      ....
   }    
}


First, make sure the following is set in localconf.php:

$TYPO3_CONF_VARS['SYS']['sqlDebug'] = '1';   
$TYPO3_CONF_VARS['FE']['debug'] = '1';  

Then try

$res = $GLOBALS['TYPO3_DB']->SELECTquery('*', 'tx_xmluploader_xml_import_tree', 'xml_import_id='.$xml_import_id);
t3lib_div::debug($res);

Result is the output of the query in the frontend. You can then execute it in MySQL for debugging.


a) make sure $xml_import_id actually has a value (one which is in the database as well)

b) Try this:

$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
   '*',
   'tx_xmluploader_xml_import_tree',
   "xml_import_id='".$xml_import_id."'"
);

How do you process the result? How does your expected $xml_import_id value look like?

cu Roman

0

精彩评论

暂无评论...
验证码 换一张
取 消