pragmaMx Support Forum

pragmaMx => Individuelle Anpassungen => Thema gestartet von: Pac06 am 06 Januar 2008, 15:40:41

Titel: Kategorien abfragen
Beitrag von: Pac06 am 06 Januar 2008, 15:40:41
Hallo Zusammen,

ich bastel mir gerade ein Top50 Modul, welches die Weblinks nach einer bestimmten Eigenschaft sortiert auflistet. Das ganze sieht bis jetzt so aus und läuft auch:

... echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"1\" width=\"100%\" bgcolor=\"#c9d5e2\" height=\"100%\"><tr><td bgcolor=\"#f2f2f2\" align=\"center\" height=\"100%\">";
echo "<table border=\"0\" cellpadding=\"1\" cellspacing=\"0\" width=\"100%\">";
echo "<tr><td><img src=\"images/top/dot.gif\" width=\"14\" height=\"21\" border=\"0\"><img src=\"images/top/topbonus.gif\" width=\"86\" height=\"21\" border=\"0\"></td><td background=\"images/top/dot2.gif\" width=\"100%\"></td></tr>";
echo "<tr><td colspan=\"2\" align=\"left\" valign=\"top\"><b>" . _AUA . "</b></td></tr>";
$show = "";
$a = 1;
$result = sql_query("select lid, title, anmeldeb from " . $prefix . "_links_links order by anmeldeb DESC limit 0,50");
$summe = array_sum(anmeldeb);
while (list($lid, $title, $anmeldeb) = sql_fetch_row($result)) {
    $title2 = str_replace(" ", "_", $title);
    echo "<tr><td nowrap><div style=\"text-indent: -8px; margin-left: 8px;\"><big>&nbsp;</big><a href=\"modules.php?name=wl_paid4&amp;op=view&amp;lid=" . $lid . "&amp;title=" . $title2 . "\">" . $title . "</a></div></td><td align=\"right\"><span class=\"tiny\">[" . $anmeldeb . " €]</span></td></tr>\n";
}
$sql = sql_query("select sum(anmeldeb)as Summe from " . $prefix . "_links_links");
list($Summe) = sql_fetch_row($sql);
echo "<tr><td colspan=\"2\" align=\"left\"><b>" . _ANMELDE1 ." <span class=\"big\">" . $Summe . " € </span>" . _ANMELDE2 ."</b></td></tr>";
echo "</table></td></tr></table>";


Nun würde ich gerne zu jedem Link die Kategorie mit anzeigen lassen und dass ist mein Problem  :red:
Wäre nett wenn mit jemand da kruz weiterhelfen könnte...

Danke und schönen Sonntag noch
Henning
Titel: Re: Kategorien abfragen
Beitrag von: Pac06 am 06 Januar 2008, 17:34:36
Hallo nochmal,

kurz zur Ergänzung: Es geht mir nur um die "handwerkliche" Seite, sprich: Wie muss die SQL-Abfrage aussehen damit ich aus der Tabelle links_links und links_categories die Informationen zu einem Eintrag abrufen kann...

Danke und MfG
Titel: Re: Kategorien abfragen
Beitrag von: Pac06 am 06 Januar 2008, 20:02:35
Habs... :BD:

Da die Frage schon öfter vorkam:

In der Abfrage (wie z.B. im Top-Modul):

$result = sql_query("select lid, cid, title, anmeldeb from " . $prefix . "_links_links order by anmeldeb DESC limit 0,50");
while (list($lid, $cid, $title, $anmeldeb, $totalvotes, $linkratingsummary) = sql_fetch_row($result)) {
    $title2 = str_replace(" ", "_", $title);
    echo "...Ausgabe
}


einfach folgendes ergänzen:

Zitat$result = sql_query("select lid, cid, title, anmeldeb from " . $prefix . "_links_links order by anmeldeb DESC limit 0,50");
while (list($lid, $cid, $title, $anmeldeb, $totalvotes, $linkratingsummary) = sql_fetch_row($result)) {
    $title2 = str_replace(" ", "_", $title);
    $res = sql_query("select title from " . $prefix . "_links_categories where cid='" . intval($cid) . "'");
    list($ctitle) = sql_fetch_row($res);
     echo "...Ausgabe
}

Und wieder was gelernt... ;)
MfG