[TYPO3-german] Re-2: Extension und relationen der Tabellen

Stefan Bothner | [m]zentrale stefan at m-zentrale.de
Fri Apr 20 11:13:28 CEST 2007


Hi,

deine Query ist auch falsch:

Du Schreibst: WHERE AND pid=
Das muss aber heissen: WHERE pid=

$query = 'SELECT * FROM tx_mhreptiles_species WHERE
pid='.intval($this->conf['pidList']).$this->cObj->enableFields('tx_mhreptile
s_species').' AND uid='.$this->internal['currentRow']['uid'];

Als nächstes solltest du auf die Funktionen der Klasse t3lib_db zugreifen um
deine Datenbankabfragen zu erstellen. Hier der Link zur API

http://typo3.org/fileadmin/typo3api-4.0.0/de/d07/classt3lib__DB.html
    

-- 
mit freundlichen Grüßen
Stefan Bothner


> -----Original Message-----
> From: typo3-german-bounces at lists.netfielders.de 
> [mailto:typo3-german-bounces at lists.netfielders.de] On Behalf 
> Of marko.hoffmann at yes-globushaus.de
> Sent: Friday, April 20, 2007 10:05 AM
> To: typo3-german at lists.netfielders.de
> Subject: [TYPO3-german] Re-2: Extension und relationen der Tabellen
> 
> Hallo Martin,
> 
> danke für Deine Antwort, jedoch bekomm ich es überhaupt nicht hin.
> Ich bekomme bei mir grundsätzlich einen Fehler:
> | debug |
> Warning: mysql_fetch_assoc(): supplied argument is not a 
> valid MySQL result resource in 
> /home/sm-reptilien/htdocs.typo3/typo3conf/ext/mhreptiles/pi1/c
lass.tx_mhreptiles_pi1.php on line 228
> 
> Kannst Du Dir das evtl. nochmal anschauen und sagen was ich 
> verkehrt mache?
> 
> CODE:
> case 'species':
>   if(!count($this->DataSpecies)){
>     $query = 'SELECT * FROM tx_mhreptiles_species WHERE AND 
> pid='.intval($this->conf['pidList']).$this->cObj->enableFields
('tx_mhreptiles_species').' AND uid='.$this->>
internal['currentRow']['uid'];
>     $res = mysql(TYPO3_db, $query);
>     while($row = mysql_fetch_assoc($res)){
>       $this->Species[$row['uid']] = $row;
>     }
>   }
> return 
> $this->Species[$this->internal['currentRow']['species']]['species'];
> break;
> 
> Grüße Marko
> 
> -------- Original Message --------
> Subject: Re: [TYPO3-german] Extension und relationen der 
> Tabellen (19-Apr-2007 14:53)
> From:    hard.one - mphanke <news- at -hardone-.-de>
> To:      typo3-german at lists.netfielders.de
> 
> > Hi,
> > 
> > das wichtigste findest du in der getfieldcontent-Funktion. 
> Da werden 
> > die einzelnen Strings ausgeworfen.
> > 
> > Viel Spaß damit.
> > 
> > HTH
> > 
> > Martin
> > 
> > SOURCE :
> > 
> > function makelist($res)	{
> > 		$items=array();
> > 			// Make list table rows
> > 		while($this->internal['currentRow'] = 
> $GLOBALS['TYPO3_DB']->sql_fetch_
> > assoc($res))	{
> > 			$items[]=$this->makeListItem();
> > 		}
> > 			$out = '<div'.$this->pi_classParam('listrow').'>
> > 			'.implode(chr(10),$items).'
> > 			</div>';
> > 		return $out;
> > 	}
> > 		/**
> > 	 * Implodes a single row from a database to a single line
> > 	 *
> > 	 * @return	Imploded column values
> > 	 */
> > 	function makeListItem()	{
> > 	  $mailForm = '';
> > 		$data = array(
> > 		  "tx_pilmailform_pi1" => array(
> > 			  "tavUID" => $this->getFieldContent('uid'),
> > 			),
> > 		);
> > 				$mailForm = 
> $this->pi_linkToPage($this->conf["mailformLabel"], 
> > $this-> conf["mailformID"], '', $data);
> > 		$callbackForm = 
> $this->pi_linkToPage($this->conf["callbackLabel"], 
> > $this-> conf["callbackID"], '', $data);
> > 
> > 		
> $markerArray['###SALUTATION###']=$this->getFieldContent('salutation');
> > 		
> $markerArray['###LASTNAME###']=$this->getFieldContent('last_name');
> > 		
> $markerArray['###FIRSTNAME###']=$this->getFieldContent('first_name');
> > 		
> $markerArray['###POS###']=$this->getFieldContent('position');
> > 		
> $markerArray['###PHONE###']=$this->getFieldContent('fon');
> > 		$markerArray['###FAX###']=$this->getFieldContent('fax');
> > 		$markerArray['###EMAIL###']= $mailForm;
> > 		$markerArray['###CALLBACK###']= $callbackForm;
> > 		
> $markerArray['###DIVISION###']=$this->getFieldContent('division');
> > 		
> $markerArray['###SUBDIVISION###']=$this->getFieldContent('subd
ivision');
> > 		
> $markerArray['###LOCATION###']=$this->getFieldContent('location');
> > 		
> $markerArray['###IMAGE###']=$this->getFieldContent('image');
> > //		
> $markerArray['###APPROACH###']=$this->getFieldContent('approach');
> > 
> > 		$content = 
> > $this->cObj->substituteMarkerArrayCached($this->templateCode,$
> > markerArray);
> > 		$content.='<!-- ROW DATA -->';
> > 		return $content;
> > 	}
> > 
> > 
> > 	function getFieldContent($fN)	{
> > 		switch($fN) {
> > /*			case 'uid':
> > 				return 
> > $this->pi_list_linkSingle($this->internal['currentRow'][$fN],$
> > this->internal['currentRow']['uid'],1); // The "1" means that the 
> > this->display
> > of single items is CACHED! Set to zero to disable caching.
> > 			break;*/
> > 			case 'salutation':
> > 					 
> if(intval($this->internal['currentRow'][$fN]) == 0)
> > 					   return 'Herr';
> > 					 else	
> if(intval($this->internal['currentRow'][$fN]) == 1)
> > 					   return 'Frau';
> > 		  break;
> > 			case 'position':
> > 					 
> if(!count($this->DataPosition)){
> > 					   $query = 'SELECT * 
> FROM tx_hoemployees_position WHERE 
> > pid='.intval($
> > 
> this->conf['pidList']).$this->cObj->enableFields('tx_hoemployees_posit
> > this->ion');
> > 
> > 						 $res = 
> mysql(TYPO3_db, $query);
> > 								
> 				 while($row = mysql_fetch_assoc($res)){
> > 						 		
> 	$this->DataPosition[$row['uid']] = $row;
> > 						 }
> > 
> > 					 }
> > 					 return 
> > $this->DataPosition[$this->internal['currentRow']['position']][
> > 'position'];
> > 			break;
> > 			case 'subdivision':
> > 					 
> if(!count($this->DataSubDivision)){
> > 					   $query = 'SELECT * 
> FROM tx_hoemployees_subdivision WHERE pid='.
> > 
> intval($this->conf['pidList']).$this->cObj->enableFields('tx_hoemploye
> > es_
> > subdivision');
> > 						 $res = 
> mysql(TYPO3_db, $query);
> > 								
> 				 while($row = mysql_fetch_assoc($res)){
> > 						 		
> 	$this->DataSubDivision[$row['uid']] = $row;
> > 						 }
> > 
> > 					 }
> > 					 return 
> $this->DataSubDivision[$this->internal['currentRow']['
> > subdivision']]['subdivision'];
> > 			break;
> > 			case 'division':
> > 					 
> if(!count($this->DataDivision)){
> > 					   $query = 'SELECT * 
> FROM tx_hoemployees_division WHERE 
> > pid='.intval($
> > 
> this->conf['pidList']).$this->cObj->enableFields('tx_hoemployees_divis
> > this->ion');
> > 
> > 						 $res = 
> mysql(TYPO3_db, $query);
> > 								
> 				 while($row = mysql_fetch_assoc($res)){
> > 						 		
> 	$this->DataDivision[$row['uid']] = $row;
> > 						 }
> > 					 }
> > 				 	 return 
> > $this->DataDivision[$this->internal['currentRow']['division']]
> > ['division'];
> > 			break;
> > 			case 'location':
> > 					 
> if(!count($this->DataLocation)){
> > 					   $query = 'SELECT * 
> FROM tx_hoemployees_city WHERE 
> > pid='.intval($
> > 
> this->conf['pidList']).$this->cObj->enableFields('tx_hoemployees_city'
> > this->);
> > 								
> 				 $res = mysql(TYPO3_db, $query);
> > 								
> 				 while($row = mysql_fetch_assoc($res)){
> > 						 		
> 	$this->DataLocation[$row['uid']] = $row;
> > 						 }
> > 					 }
> > 					 return 
> > $this->DataLocation[$this->internal['currentRow']['location']][
> > 'city'];
> > 			break;
> > 			case 'image':
> > 				
> if($this->internal['currentRow'][$fN] != null)
> > 				{
> > 					return '<img 
> src="/uploads/'.$this->prefixId.'/'.$this->internal['
> > currentRow'][$fN].'" width="80" height="80">';
> > 				}
> > 				else
> > 					return '';
> > 			break;
> > 			default:
> > 				return 
> $this->internal['currentRow'][$fN];
> > 			break;
> > 		}
> > 	}
> > _______________________________________________
> > TYPO3-german mailing list
> > TYPO3-german at lists.netfielders.de
> > http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-german
> 
> 
> _______________________________________________
> TYPO3-german mailing list
> TYPO3-german at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-german
> 



More information about the TYPO3-german mailing list