Kategorien... Unterketegorien...

bastiang

Mitglied
PHP:
<?
require_once('../../Connections/gptickteshop.php');
mysql_select_db('hisshopsql', $gptickteshop);
$query_tri = "SELECT * FROM shopdb WHERE GRUPPE = 'tri' ORDER BY GRUPPE2";
$tri = mysql_query($query_tri, $gptickteshop) or die(mysql_error());
$row_tri = mysql_fetch_assoc($tri);
$totalRows_tri = mysql_num_rows($tri);

do {

  if(isset($row_tri['GRUPPE2']) && $row_tri['GRUPPE2'] != NULL){
     echo $row_tri['GRUPPE'];
     $akt_gruppe =  $row_tri['GRUPPE2'];

  echo $row_tri['GRUPPE2']."<br>";

    if($akt_gruppe =  $row_tri['GRUPPE2']){
     echo $row_tri['NAME1_SHORT_DE']." ".$row_tri['GRUPPE']."<br>";

  }

}


}while  ($row_tri = mysql_fetch_assoc($tri)); ?>
Ich hätte gerne, dass das Script die Unterkategorie also GRUPPE2 nur einmal ausgibt, und dann alle artikel, die die dazupassende Unterkategorie haben? Wie mach ich das?
 
Habs jetzt anders gelöst...
Hab in der Datenbank die Unterkategorien definiert und frage dan anhand dieser die Einträge für die Jeweilige Unterkategorie ab....
Aber eines passt noch nicht er gibt die Kategorie-Titel alle in einer zeile aus und dann erst die Einträge..
Script 1:
PHP:
<?
// Setzen der Variablen
$cat_id = $_GET['c'];
$event_id = $_GET['e'];
// Datenbank abfrage des Events
mysql_select_db($database_gptickteshop, $gptickteshop);
$query_info = "SELECT status,desc_de,cat_id,e,currency,sub_cat_order FROM events WHERE cat_id = '$cat_id' AND event_id = '$event_id' ORDER BY status";
$info = mysql_query($query_info, $gptickteshop) or die(mysql_error());
$row_info = mysql_fetch_assoc($info);
$totalRows_info = mysql_num_rows($info);
// Setzten der Gruppe
  $group = 'tri';
  $group1 = 'ste';
  $group2 = 'ext';
// bei mehereren einfach kopieren zB. so:  $group = $row_info['country_de']."St"; usw.
?>
<span class="inf_table_title"><? if($lang_id == "de") { echo "Tribünentickets";} else { echo "Grandstandtickets";} ?></span>
<div id="tickets">
<? include('./components/tickets_legende.php'); ?>
<table width="560" border="0" align="center" cellpadding="0" cellspacing="0" id="tickets_table">
<?
if(isset($row_info['sub_cat_order'])){
   $ordering = explode(",", $row_info['sub_cat_order'] );
   $anzahl = count($ordering);
   $i = -1;
   do {
        print $ordering[$i++];
        $gruppe2 = $ordering[$i];
        include('./templates/race_sub/tic2.php');
    } while($i <= $anzahl);

      
}


?>
Script 2:
</table>

PHP:
<?

$cat_id = $_GET['c'];
$event_id = $_GET['e'];
mysql_select_db('hisshopsql', $gptickteshop);
$query_tri = "SELECT * FROM shopdb WHERE CAT_ID = '$cat_id' AND EVENT_ID = '$event_id' AND GRUPPE = '$group' AND GRUPPE2 = '$gruppe2'";
$tri = mysql_query($query_tri, $gptickteshop) or die(mysql_error());
$row_tri = mysql_fetch_assoc($tri);
$totalRows_tri = mysql_num_rows($tri);


?>


<? do { ?>
<? if ($row_tri['DISPLAY'] == 'Y') { ?>
	<form action="/cgi-bin/shopneusql.cgi" method="GET">
	<input type="hidden" name="t" value="tembaske_<? if($lang_id == "de") { echo "de";} else { echo "en";} ?>">
	<tr class="tickets_off" onMouseOver="this.className='tickets_over'" onMouseOut="this.className='tickets_off'" onClick="this.className='tickets_on'">
		<td width="5"></td>
		<td width="13"><? if ($row_tri['I_COV'] == 'Y') { echo "<img src=\"./images/symbols/t_cov.gif\" width=\"12\" height=\"12\">"; } ?></td>
		<td width="13"><? if ($row_tri['I_NUM'] == 'Y') { echo "<img src=\"./images/symbols/t_num.gif\" width=\"12\" height=\"12\">"; } ?></td>
		<td width="15"><? if ($row_tri['I_TV'] == 'Y') { echo "<img src=\"./images/symbols/t_tv.gif\" width=\"12\" height=\"12\">"; } ?></td>
		<td width="325"><? if (!empty($row_tri['IMAGE']) && $row_tri['IMAGE'] != 'nein') {echo "<a href=\"#\">";} ?><b><? echo $row_tri['GRUPPE2']; if($lang_id == "de") {echo $row_tri['NAME1_SHORT_DE'];} else { echo $row_tri['NAME1_SHORT_EN'];} ?></b> <? if($lang_id == "de") { echo $row_tri['NAME2_SHORT_DE'];} else { echo $row_tri['NAME2_SHORT_EN'];} ?><? if (!empty($row_tri['IMAGE']) && $row_tri['IMAGE'] != 'nein') {echo "</a>";} ?></td>
		<td width="23"><? if ($row_tri['PREIS_EUR'] > '0') {echo "EUR";} else { echo "USD"; } ?></td>
		<td width="52" align="right"><? if ($row_tri['PREIS_EUR'] > '0') {echo $row_tri['PREIS_EUR'];} else { echo $row_tri['PREIS_USD']; } ?></td>
<? if ($row_tri['STOCK'] > 0 && $row_info['status'] == 'normal') { ?>
		<td width="44"><button type="button" onclick="rechnen('<? echo $row_tri['NR'] ?>','-')">-</button><input name="<? echo $row_tri['NR'] ?>" type="text" class="tickets_input" value="1" maxlength="3" id="<? echo $row_tri['NR'] ?>"><button type="button" onclick="rechnen('<? echo $row_tri['NR'] ?>','+')">+</button></td>
		<td width="65"><input type="submit" value="<? if($lang_id == "de") { echo "bestellen";} else { echo "order";} ?>" class="tickets_order"></td>
<? } elseif ($row_tri['STOCK'] == 0 && $row_info['status'] == 'normal' || $row_info['status'] == 'sold_out') { ?>
		<td width="109" colspan="2" class="tickets_soldout"><? if($lang_id == "de") { echo "ausverkauft";} else { echo "sold out";} ?></td>
<? } elseif ($row_info['status'] == 'ended') { ?>
		<td width="109" colspan="2" class="tickets_soldout"><? if($lang_id == "de") { echo "beendet";} else { echo "sale ended";} ?></td>
<? } ?>
		<td width="5"></td>
	</tr>

	</form>
<? } ?>
<? }while  ($row_tri = mysql_fetch_assoc($tri)); ?>
Fehler gesichtet oder lösungsvorschlag?
 
Zurück