TYPO3:带有 where 子句的 exec_SELECTquery
以下 select
返回一个空结果集,尽管它不应该:
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_xmluploader_xml_import_tree', 'xml_import_id ='.$xml_import_id);
$xml_import_id
已设置。如果我删除 where
子句,它就会起作用。
谢谢,
我仍然不明白为什么它不起作用。同事建议的一个简单的解决方法:
// 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 ) {
....
}
}
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 ) {
....
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,确保在 localconf.php 中设置以下内容:
然后尝试
结果是前端查询的输出。然后可以在MySQL中执行它进行调试。
First, make sure the following is set in localconf.php:
Then try
Result is the output of the query in the frontend. You can then execute it in MySQL for debugging.
a) 确保 $xml_import_id 实际上有一个值(也在数据库中)
b) 试试这个:
如何处理结果?
您期望的 $xml_import_id 值是什么样的?
铜
罗马
a) make sure $xml_import_id actually has a value (one which is in the database as well)
b) Try this:
How do you process the result?
How does your expected $xml_import_id value look like?
cu
Roman