Seite 2 von 2
Verfasst: 22.05.2003 10:50
von Tekknotrip
@itst:
Schau mal hier:
http://www.technoguide.de/location/wwwboardclub1.php
zum Verständniss:
So sieht das Original aus:
http://www.talk-netz.de/viewforum.php?f=57
Code: Alles auswählen
$result = mysql_query( "SELECT forum_id, topic_title, topic_replies, topic_views, topic_id FROM technoforum_topics WHERE forum_id=57 ORDER BY topic_title");
while ($row = mysql_fetch_array($result))
{
$clubname = "$row[topic_title]";
$clubname = eregi_replace ("wie, wo, was!!!","",$clubname);
$clubname = explode("-", $clubname);
$club = $clubname[0];
$stadt = $clubname[1];
echo "<tr onmouseover=\"setPointer(this, '#3B3B3B')\" onmouseout=\"setPointer(this, 'black')\" valign=top>
<td><a href=\"http://www.talk-netz.de/viewtopic.php?t=$row[topic_id]\"><strong>";
echo $club;
echo "</strong></a></td>";
echo "<td align=left>$stadt</td>";
echo "<td align=left>($row[topic_replies])</td>";
echo "<td align=left>($row[topic_views])</td></tr>";
}
?>
Verfasst: 22.05.2003 11:11
von itst
Ungeteset, ohne Gewähr:
Erstmal alle Daten einlesen und nach Clubs und Städten ausdröseln:
Code: Alles auswählen
while ($row = mysql_fetch_array($result))
{
$clubname = "$row[topic_title]";
$clubname = explode("-", $clubname);
$club[$row['topic_id']] = $clubname[0];
$stadt[$row['topic_id']] = $clubname[1];
$daten[$row['topic_id']] = $row;
}
Jetzt hast Du Clubs und Städte sowie die restlichen Daten geordnet nach der Topic-ID vorliegen und kannst sortieren wie Du willst.
HTH, Sascha
Verfasst: 22.05.2003 11:14
von bloddy newbie
machs doch mal so:
Code: Alles auswählen
...
while ($row = mysql_fetch_array($result))
{
$clubname = "$row[topic_title]";
$clubname = eregi_replace ("wie, wo, was!!!","",$clubname);
$clubname = explode("-", $clubname);
$club[] = $clubname[0];
$stadt[] = $clubname[1];
}
array_multisort ($club, SORT_ASC, SORT_STRING, $stadt, SORT_NUMERIC, SORT_DESC);
for($x=0; $x<count($club);$x++)
{
echo "<tr onmouseover=\"setPointer(this, '#3B3B3B')\" onmouseout=\"setPointer(this, 'black')\" valign=top>
<td><a href=\"http://www.talk-netz.de/viewtopic.php?t=$row[topic_id]\"><strong>";
echo $club[$x];
echo "</strong></a></td>";
echo "<td align=left>$stadt[$x]</td>";
echo "<td align=left>($row[topic_replies])</td>";
echo "<td align=left>($row[topic_views])</td></tr>";
}
cu bloddy
Verfasst: 22.05.2003 12:03
von Tekknotrip
Verfasst: 22.05.2003 12:11
von itst
Kann es sein, das bloody's Script nicht ganz hinhaut? Als topic_id wird doch immer die letzte aus der Query genommen (genausop wie topic_views und _replys).
Oder hab ich Tomaten auf den Augen?
Verfasst: 22.05.2003 12:35
von bloddy newbie
ich habe mit absicht nur auf seine frage geantwortet...er muß halt nur noch die anderen ids mit sortieren lassen und fertig ist der brei.
cu bloddy
nachtrag

:
Code: Alles auswählen
while ($row = mysql_fetch_array($result))
{
$clubname = "$row[topic_title]";
$clubname = eregi_replace ("wie, wo, was!!!","",$clubname);
$clubname = explode("-", $clubname);
$club[] = $clubname[0];
$stadt[] = $clubname[1];
$topic_id[] = $row['topic_id'];
$topic_replies[] = $row['topic_replies'];
$topic_views[] = $row['topic_views'];
}
array_multisort ($club, SORT_ASC, SORT_STRING, $stadt, SORT_NUMERIC, SORT_DESC, $topic_id, $topic_replies, $topic_views);
for($x=0; $x<count($club);$x++)
{
echo "<tr onmouseover=\"setPointer(this, '#3B3B3B')\" onmouseout=\"setPointer(this, 'black')\" valign=top>
<td><a href=\"http://www.talk-netz.de/viewtopic.php?t=$topic_id[$x]\"><strong>";
echo $club[$x];
echo "</strong></a></td>";
echo "<td align=left>$stadt[$x]</td>";
echo "<td align=left>($topic_replies[$x])</td>";
echo "<td align=left>($topic_views[$x])</td></tr>";
}
Verfasst: 22.05.2003 14:19
von Tekknotrip
@bloddy newbie
Danke danke.....
Hatte in der Tat nur das Lösungsbeispiel gebraucht, der rest wurde gleichfalls angeglichen
Kann man im Übrigen auch gut verwenden für das Phpbb Forum (so mach ich es ja auch), Datensplitting und dann Neusortierung, beispielsweise so wie die Clubliste hier
Danke euch jedenfalls!!!
SUPER!!