Bug #16652

mysql_fetch_assoc If in tca select->maxitems > 1 AND foreign_table_where contains "sys_language_uid = ###REC_FIELD_sys_langu...

Added by Sascha Egerer over 13 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2006-10-18
Due date:
% Done:

0%

TYPO3 Version:
4.0
PHP Version:
4.3
Tags:
Complexity:
Is Regression:
Sprint Focus:

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)

rec_field.patch View (1.04 KB) Administrator Admin, 2008-04-30 12:02

TYPO3_4-1-rec_field.patch View (1.08 KB) Administrator Admin, 2009-07-03 10:21

TYPO3_4-2-rec_field.patch View (1.21 KB) Administrator Admin, 2009-07-03 10:22

TYPO3_trunk-rec_field.patch View (1.21 KB) Administrator Admin, 2009-07-03 10:22


Related issues

Related to TYPO3 Core - Feature #17500: Localization of child records Closed 2007-08-06

History

#1 Updated by Sascha Egerer over 13 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

#2 Updated by Steffen Kamper about 13 years ago

Hi,

i found a workaround - I use this expression:
CAST

So if the marker is empty it will be converted to 0

#3 Updated by Andreas Otto † over 11 years ago

Hi Steffen,

your workaround sounds good.

Is the cast expression standard sql?

#4 Updated by Andreas Otto † over 11 years ago

A while ago I created a patch for the 4.1 branch.
Maybe the patch is of help.

#5 Updated by Andreas Otto † over 10 years ago

I have added patches for trunk (4.3), 4.2 and 4.1 which correct the odd situation.

#6 Updated by Andreas Otto † over 10 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.

#7 Updated by Andreas Otto † over 10 years ago

Unassigning the issue from myself.

#8 Updated by Alexander Opitz over 6 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?

#9 Updated by Alexander Opitz over 6 years ago

  • Status changed from Needs Feedback to Closed

No feedback for over 90 days.

Also available in: Atom PDF