Bug #16652
closedmysql_fetch_assoc If in tca select->maxitems > 1 AND foreign_table_where contains "sys_language_uid = ###REC_FIELD_sys_langu...
0%
Description
I have createt an extension. When I write the following in the tca.php File I get the an error:
"config" => Array (
"type" => "select",
"foreign_table" => "xxx",
"foreign_table_where" => "AND xxx.sys_language_uid = ###REC_FIELD_sys_language_uid### ORDER BY xxx.name",
"maxitems" => 100,
....
)
I get this error if I create a record of this type:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in xxx/htdocs/typo3_src-4.0/t3lib/class.t3lib_db.php on line 801
The error comes only if "###REC_FIELD_sys_language_uid### " is in the "foreign_table_where" AND "maxitems" is higher then 1.
If I set "maxitems" = 1 or I delete the part "AND xxx.sys_language_uid = ###REC_FIELD_sys_language_uid###" the error does not come.
(sorry if my english is not so good.... ;-) )
(issue imported from #M4405)
Files
Updated by Sascha Egerer about 18 years ago
Sorry I've forgot something.
This error only comes if I create a new record. If I press the save Button or edit an existing record then comes no error.
Maybe the "###REC_FIELD_sys_language_uid###" marker is not set correctly if
- the record is not saved
- maxitems is 1
Updated by Steffen Kamper about 18 years ago
Hi,
i found a workaround - I use this expression:
CAST
So if the marker is empty it will be converted to 0
Updated by Andreas Otto † over 16 years ago
Hi Steffen,
your workaround sounds good.
Is the cast expression standard sql?
Updated by Andreas Otto † over 16 years ago
A while ago I created a patch for the 4.1 branch.
Maybe the patch is of help.
Updated by Andreas Otto † over 15 years ago
I have added patches for trunk (4.3), 4.2 and 4.1 which correct the odd situation.
Updated by Andreas Otto † over 15 years ago
As mentioned in my note from 2008-04-30 this can easily be fixed with the patches attached.
This odd situation does only appear if you use a ###REC_FIELD_*### marker inside the foreign_table_where configuration.
$TCA['tx_faqs']['columns']['similar_faq']['config']['foreign_table_where'] = ' AND tx_faqs.deleted=0 AND tx_faqs.pid IN (103) AND tx_faqs.sys_language_uid=###REC_FIELD_sys_language_uid### ORDER BY tx_faqs.question ASC'
The example above would only list other records if they have the same sys_language_uid which keeps the list smaller if you have more than 2 languages on your TYPO3 installation.
Updated by Alexander Opitz over 11 years ago
- Status changed from Accepted to Needs Feedback
- Target version deleted (
0)
As this report is very old, is the handling in newer TYPO3 CMS Versions (like 6.0/6.1) more like you expect it?
Updated by Alexander Opitz about 11 years ago
- Status changed from Needs Feedback to Closed
No feedback for over 90 days.