Zum Inhalt springen

IRRE und mysql_fetch_assoc

Erstellt am 3. April 2008 · 3 Antworten · letzte Antwort am 4. April 2008

Tags: TCA, Datenbank, Frage

FrankT ·

Hallo,

ich möchte eine Extension schreiben mit Dates und States.
Zu jedem Date soll es ein State geben.

Mein Problem ist im Backend diese Fehlermeldung:

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in ...

Meine ext_tables.sql:

#
# Table structure for table 'tx_xinfo_dates'
#
CREATE TABLE tx_xinfo_dates (
	uid int(11) NOT NULL auto_increment,
	pid int(11) DEFAULT '0' NOT NULL,
	tstamp int(11) DEFAULT '0' NOT NULL,
	crdate int(11) DEFAULT '0' NOT NULL,
	cruser_id int(11) DEFAULT '0' NOT NULL,
	sys_language_uid int(11) DEFAULT '0' NOT NULL,
	l18n_parent int(11) DEFAULT '0' NOT NULL,
	l18n_diffsource mediumblob NOT NULL,
	sorting int(10) DEFAULT '0' NOT NULL,
	deleted tinyint(4) DEFAULT '0' NOT NULL,
	hidden tinyint(4) DEFAULT '0' NOT NULL,
	starttime int(11) DEFAULT '0' NOT NULL,
	endtime int(11) DEFAULT '0' NOT NULL,
	fe_group varchar(100) DEFAULT '' NOT NULL,
	projects blob NOT NULL,
	title varchar(40) DEFAULT '' NOT NULL,
	description text NOT NULL,
	date_start int(11) DEFAULT '0' NOT NULL,
	date_end int(11) DEFAULT '0' NOT NULL,
	state int(11) DEFAULT '0' NOT NULL,
	date_start_other int(11) DEFAULT '0' NOT NULL,
	date_end_other int(11) DEFAULT '0' NOT NULL,
	state_other int(11) DEFAULT '0' NOT NULL,
	
	PRIMARY KEY (uid),
	KEY parent (pid)
);



#
# Table structure for table 'tx_xinfo_dates_datestates_rel'
#
CREATE TABLE tx_xinfo_dates_datestates_rel (
	uid int(11) NOT NULL auto_increment,
	pid int(11) DEFAULT '0' NOT NULL,
	tstamp int(11) DEFAULT '0' NOT NULL,
	crdate int(11) DEFAULT '0' NOT NULL,
	cruser_id int(11) DEFAULT '0' NOT NULL,
	deleted tinyint(4) DEFAULT '0' NOT NULL,
	hidden tinyint(4) DEFAULT '0' NOT NULL,
	date_id int(11) DEFAULT '0' NOT NULL,
	dstate_id int(11) DEFAULT '0' NOT NULL,
	
	PRIMARY KEY (uid),
	KEY parent (pid)
);



#
# Table structure for table 'tx_xinfo_datestates'
#
CREATE TABLE tx_xinfo_datestates (
	uid int(11) NOT NULL auto_increment,
	pid int(11) DEFAULT '0' NOT NULL,
	tstamp int(11) DEFAULT '0' NOT NULL,
	crdate int(11) DEFAULT '0' NOT NULL,
	cruser_id int(11) DEFAULT '0' NOT NULL,
	sys_language_uid int(11) DEFAULT '0' NOT NULL,
	l18n_parent int(11) DEFAULT '0' NOT NULL,
	l18n_diffsource mediumblob NOT NULL,
	deleted tinyint(4) DEFAULT '0' NOT NULL,
	hidden tinyint(4) DEFAULT '0' NOT NULL,
	title varchar(40) DEFAULT '' NOT NULL,
	
	PRIMARY KEY (uid),
	KEY parent (pid)
);

Meine TCA:

$TCA["tx_xinfo_dates"] = array (
	"ctrl" => $TCA["tx_xinfo_dates"]["ctrl"],
	"interface" => array (
		"showRecordFieldList" => "sys_language_uid,l18n_parent,l18n_diffsource,hidden,starttime,endtime,fe_group,projects,title,description,date_start,date_end,state,date_start_other,date_end_other,state_other"
	),
	"feInterface" => $TCA["tx_xinfo_dates"]["feInterface"],
	"columns" => array (

...

		"state" => Array (		
			"exclude" => 1,		
			"label" => "LLL:EXT:x_info/locallang_db.xml:tx_xinfo_dates.state",		
			"config" => Array (
				"type"     => "inline",
				"foreign_table"     => "tx_xinfo_dates_datestates_rel",
				"foreign_field"     => "date_id",
				"foreign_selector"    => "dstate_id",
				"maxitems"          => 1,
				"appearance" => array(
					'useCombination' => 1,
				)
			)
		),

...

);



$TCA["tx_xinfo_dates_datestates_rel"] = array (
	"ctrl" => $TCA["tx_xinfo_dates_datestates_rel"]["ctrl"],
	"interface" => array (
		"showRecordFieldList" => "hidden,date_id,dstate_id"
	),
	"feInterface" => $TCA["tx_xinfo_dates_datestates_rel"]["feInterface"],
	"columns" => array (

...

		"date_id" => Array (		
			"exclude" => 1,		
			"label" => "LLL:EXT:x_info/locallang_db.xml:tx_xinfo_dates_datestates_rel.date_id",		
			"config" => Array (
				"type"     => "select",
				"foreign_table"   => "tx_xinfo_dates",
				"maxitems"        => 1,
			)
		),
		"dstate_id" => Array (		
			"exclude" => 0,		
			"label" => "LLL:EXT:x_info/locallang_db.xml:tx_xinfo_dates_datestates_rel.dstate_id",		
			"config" => Array (
				"type"     => "select",
				"foreign_table"   => "tx_xinfo_datestates",
				"maxitems"        => 1,
			)
		),
	),

...

);



$TCA["tx_xinfo_datestates"] = array (
	"ctrl" => $TCA["tx_xinfo_datestates"]["ctrl"],
	"interface" => array (
		"showRecordFieldList" => "sys_language_uid,l18n_parent,l18n_diffsource,hidden,title,dates"
	),
	"feInterface" => $TCA["tx_xinfo_datestates"]["feInterface"],
	"columns" => array (

...

		"dates" => Array (		
			"exclude" => 0,		
			"label" => "LLL:EXT:x_info/locallang_db.xml:tx_xinfo_datestates.dates",		
			"config" => Array (
				"type"     => "inline",
				"foreign_table"     => "tx_xinfo_dates_datestates_rel",
				"foreign_field"     => "dstate_id",
				"foreign_selector"    => "date_id",
				"maxitems"          => 1,
				"appearance" => array(
					'useCombination' => 1,
				)
			)
		),
	),

...

);

Im Backend wird nur die Überschrift von states angezeigt und eben die Fehlermeldung.

Wenn ich es so mache (ohne Zwischetabelle) ...

		"state" => Array (		
			"exclude" => 1,		
			"label" => "LLL:EXT:x_info/locallang_db.xml:tx_xinfo_dates.state",		
			"config" => Array (
				"type"     => "inline",
				"foreign_table"     => "tx_xinfo_datestates",
				"foreign_field"     => "uid",
				"foreign_selector"    => "uid",
				"maxitems"          => 1,
				"appearance" => array(
					'useCombination' => 1,
				)
			)
		),

... dann wird der Link "Neu anlegen" angezeigt und auch die Fehlermeldung.

Wer kann mir weiterhelfen?

Trotz mehrerer Dokus finde ich nicht den richtigen Weg. #angry#

Vielen Dank
Frank

just2b ·

sqldebug im install tool einschalten, dann siehst mal mehr. oder ein compare und schauen ob wirklich alle tabellen da sind. es wird dir keiner jetzt die ext so nachbauen

georg

FrankT ·

Hallo just2b,

sorry ich habe vergessen zu schreiben, wo der Fehler genauer liegt:

Bei ...

SELECT tx_xinfo_datestates.uid,tx_xinfo_datestates.
FROM tx_xinfo_datestates,pages
WHERE
pages.uid=tx_xinfo_datestates.pid
AND pages.deleted=0 AND 1=1

... fehlt aus irgendwelchen Gründen beim zweiten tx_xinfo_datestates. die Tabellenspalte.

Ändere ich in der class.t3lib_db.php die folgende Funktion ...

function exec_SELECTquery($select_fields,$from_table,$where_clause,$groupBy='',$orderBy='',$limit='')	{
	$select_fields = '*';

... dann gibt es keine Fehlermeldung mehr, aber das ist sicherlich absolut keine gute Lösung.

Zudem erscheint bei der zweiten Version (s.o.) der Link "Neu anlegen", aber wenn ich darauf klicke, tut sich nichts.

Gruß
Frank