id´s

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • id´s

    Hey...

    ich habe mir ein downloadsystem gebaut, natürlich auf php basierend, mit ids, ect
    natürlich alles mit sql

    so jetzt möchte ich aber, das die downloads, zb automatisch nach den meistn downloads sortiert werden, oder das man es zumindest per mausklick machen kann, evt auch top ten... die leezte runtergeladene...
    das heisst ich muss die ids auslesen un richtig zuordnen un sortieren..

    ich hab schon viel probiert und rumgefrat aber bis jetzt war alles nich sehr hilfreich...

    könnte mir da evt jmd helfen?
    wäre irgendwie schon wichtig

    FETTEN DANK



    Mail: Masterlucifer@web.de

  • #2
    Und die ID´s nach den Downloads zu sortieren musst du diese beim auslesen mit Select ... order by Spaltenname machen.
    mfg
    Günni


    Praxis: Jeder kann´s, aber keiner weiß wie´s geht...
    Theorie: Jeder weiß wie´s geht, aber keiner kann´s ...
    Microsoft vereint Praxis und Theorie: Nix geht und keiner weiß warum
    City-Tiger - Online durch die Straßen tigern...

    Kommentar


    • #3
      und für die top ten:

      ... order by spalte_für_anzahl_downloads limit 0, 10

      Kommentar


      • #4
        und optional:

        ... ORDER BY spalte_für_anzahl_downloads LIMIT 0, 10 DESC

        Kommentar


        • #5
          und weil's so schön ist, kommt das ganze noch in richtige forum

          *VERSCHIEB* nach sql
          INFO: Erst suchen, dann posten![color=red] | [/color]MANUAL(s): PHP | MySQL | HTML/JS/CSS[color=red] | [/color]NICE: GNOME Do | TESTS: Gästebuch[color=red] | [/color]IM: Jabber.org |


          Kommentar


          • #6
            also ich habs jetz mal soweit gemacht, klappt auch alles:


            PHP-Code:
            <? 
             mysql_connect('localhost','bandit','***********'); 
             mysql_select_db('bandit'); 
             $sql = "SELECT 
                   `url`, 
                    `name`, 
                   `klicks`, 
                   `info` 
                 FROM 
                   `download` 
                 ORDER BY 
                   `klicks` DESC;"; 
             $result = mysql_query($sql) OR die(mysql_error()); 
             echo ' 
             <table cellpadding="0" cellspacing="0" border="1" width="500"> 
             <tr> 
             <td width="450"><b>Download/Beschreibung</b></td> 
             <td width="50" align="center"><b>Klicks</b></td> 
             </tr>'; 
             while($row = mysql_fetch_assoc($result)) 
             { 
               echo ' 
               <tr> 
               <td><a href="'.$row['url'].'">'.$row['name'].'</a><br><font size="1">'.$row['info'].'</ font></td> 
               <td>'.$row['klicks'].'</td> 
               </tr>'; 
             } 
             echo '</table>'; 
            ?>

            ^^das ist jetzt, das er die nach den downloads sortiert, die meistens zuerst, nur ist da zb das problem, das er jetzt nur de link anzeigt den direkten, ohne id ect, und ausserdem hab ich es in eine extra datei gepackt..so wie mach ich es nun, dass die downloads nach den meisten zuerst sortiert werden, und so dargestellt werden wie in der normalen datei

            normale datei:

            <style type="text/css">
                 <!--
                 a:link { text-decoration: none; color: #FFFFFF; }
                 a:visited { text-decoration: none; color: #FFFFFF;}
                 a:activ { text-decoration: none; color: #FFFFFF;}
                 a:hover { text-decoration: overline underline; color: #FFFFFF;}
                 //-->
                 </style>

            <?
            include("config.php");
            echo "<body bgcolor=$bgcolor text=$fontcolor>";
            mysql_connect($server, $user, $pass) OR die("Keine Verbindung zum Server moeglich");
            mysql_select_db($dbase) or die("Keine Verbindung zur Datenbank moeglich");
            echo "<center>";

            $ergebnis=mysql_query("SELECT DISTINCT cat FROM download");
            while($row=mysql_fetch_object($ergebnis)){
            }




            echo "<table width=600>";
             echo "<tr>";
             echo "<td align=center width=70>".$fonts2."</td>";
             echo "<td align=left width=240>".$fonts2."</td>";
             echo "<td align=center width=70>".$fonts2."</td>";
             echo "<td align=center width=40>".$fonts2."</td>";
             echo "<td align=center width=70>".$fonts2."</td>";
             
             echo "</td></tr>";
            $ergebnis=mysql_query("select * from download WHERE cat='$cat'");
            while($row=mysql_fetch_object($ergebnis))
             {
             echo "<tr><td align=center width=70>";
             echo "".$fonts2."$row->date</td>";
             echo "<td>".$fonts2."$row->name</td>";
             echo "<td align=center>".$fonts2."";
             ?>
             <? echo "$fonts2"; ?>[&nbsp;<a href="#" onClick="window.open(<? echo "'dl-manager/info.php?id=$row->id'"; ?>, 'NewWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=n0,width=640,height=480,left=100,top=100')" OnMouseOver="window.status='Infos zu <? echo "$row->name"; ?>';return true" OnMouseOut="window.status='';return true"><? echo "$fonts2"; ?>info</a><? echo "$fonts2"; ?>&nbsp;]</td>
             <?
             echo "<td align=center><a href=dl-manager/download.php?id=$row->id target=_blank>".$fonts2."here</a></td>";
             echo "<td align=center>".$fonts2."$row->klicks </td>";
             $id = $row->id;
             $query = "SELECT COUNT(id) AS total FROM comments WHERE dlid='$row->id'";
             $result = mysql_query($query);

             echo "<td>";
             echo "$fonts2";
             ?>
             

            <?


             echo "</tr>";
             }
             echo "</table>";

            Ich möchte das das aussehn in keiner weise verändert wird, und das die links auch noch mit id sind, da er ja sonst die downloads nicht mehr zählt, weiss jmd so ungefähr wie ich das machen muss, oder könnte? weil da hört mein verständnis dann echt auf..

            EDIT:
            php.tags sponsored by daddy.
            Abraxax

            Zuletzt geändert von Abraxax; 23.06.2003, 22:55.

            Kommentar


            • #7
              indem du die abfrage in der normalen seite so änderst wie in der extra datei?
              Ich denke, also bin ich. - Einige sind trotzdem...

              Kommentar


              • #8
                hi nochmal..

                also ich hab jetzt alles versucht, aber jdesmal wenn ich die if abfrage da reinsetz zeigt der mir einfach gar nix mehr an...

                PHP-Code:
                <style type="text/css">
                     <!--
                     a:link { text-decoration: none; color: #FFFFFF; }
                     a:visited { text-decoration: none; color: #FFFFFF;}
                     a:activ { text-decoration: none; color: #FFFFFF;}
                     a:hover { text-decoration: overline underline; color: #FFFFFF;}
                     //-->
                     </style>

                <?
                include("config.php");
                echo "<body bgcolor=$bgcolor text=$fontcolor>";
                mysql_connect($server, $user, $pass) OR die("Keine Verbindung zum Server moeglich");
                mysql_select_db($dbase) or die("Keine Verbindung zur Datenbank moeglich");
                echo "<center>";

                $ergebnis=mysql_query("SELECT DISTINCT cat FROM download");
                while($row=mysql_fetch_object($ergebnis)){
                }




                echo "<table width=600>";
                 echo "<tr>";
                 echo "<td align=center width=70>".$fonts2."</td>";
                 echo "<td align=left width=240>".$fonts2."</td>";
                 echo "<td align=center width=70>".$fonts2."</td>";
                 echo "<td align=center width=40>".$fonts2."</td>";
                 echo "<td align=center width=70>".$fonts2."</td>";
                 
                 echo "</td></tr>";
                $ergebnis=mysql_query("select * from download WHERE cat='$cat'");
                while($row=mysql_fetch_object($ergebnis))
                 {
                 echo "<tr><td align=center width=70>";
                 echo "".$fonts2."$row->date</td>";
                 echo "<td>".$fonts2."$row->name</td>";
                 echo "<td align=center>".$fonts2."";
                ?> 
                <? 
                  echo $fonts2.'[&nbsp;<a href="#" onClick="window.open(\'dl-manager/info.php?id='.$row->id.'\', \'NewWindow\',\'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=n0,width=640,height=480,left=100,top=100\')" OnMouseOver="window.status=\'Infos zu '.$row->name.'\';return true" OnMouseOut="window.status=\'\';return true"> '.$fonts2.' info</a> '.$fonts2.' &nbsp;]</td>'; 
                ?> 


                 echo "<td align=center><a href=dl-manager/download.php?id=$row->id target=_blank>".$fonts2."here</a></td>";
                 echo "<td align=center>".$fonts2."$row->klicks </td>";
                 $id = $row->id;
                 $query = "SELECT COUNT(id) AS total FROM comments WHERE dlid='$row->id'";
                 $result = mysql_query($query);

                 echo "<td>";
                 echo "$fonts2";
                 ?>
                 

                <?


                 echo "</tr>";
                 }
                 echo "</table>";
                das ist die index..... ich möchte aber ja nun das sie nach klicks geordnet wird...
                aber das geht absolut nicht bei mir...

                ich habe es nun so:

                PHP-Code:
                <? include("config.php") ?>

                <? 
                error_reporting(E_ALL);  
                mysql_connect('localhost','bandit',''); 
                 mysql_select_db('bandit'); 
                 $sql = "SELECT 
                       `id`, 
                        `name`, 
                       `klicks`, 
                       `info` 
                     FROM 
                       `download` 
                     ORDER BY 
                       `klicks` DESC;"; 
                 $result = mysql_query($sql) OR die(mysql_error()); 
                echo "<table width=600>";
                 echo "<tr>";
                 echo "<td align=center width=70>".$fonts2."</td>";
                 echo "<td align=left width=240>".$fonts2."</td>";
                 echo "<td align=center width=70>".$fonts2."</td>";
                 echo "<td align=center width=40>".$fonts2."</td>";
                 echo "<td align=center width=70>".$fonts2."</td>";
                 
                 echo "</td></tr>";
                $ergebnis=mysql_query("select * from download WHERE cat='$cat'");
                while($row=mysql_fetch_object($ergebnis))
                 {
                 echo "<tr><td align=center width=70>";
                 echo "".$fonts2."$row->date</td>";
                 echo "<td>".$fonts2."$row->name</td>";
                 echo "<td align=center>".$fonts2."";
                 ?>
                 <? echo "$fonts2"; ?>[&nbsp;<a href="#" onClick="window.open(<? echo "'dl-manager/info.php?id=$row->id'"; ?>, 'NewWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=n0,width=640,height=480,left=100,top=100')" OnMouseOver="window.status='Infos zu <? echo "$row->name"; ?>';return true" OnMouseOut="window.status='';return true"><? echo "$fonts2"; ?>info</a><? echo "$fonts2"; ?>&nbsp;]</td>
                 <?
                 echo "<td align=center><a href=dl-manager/download.php?id=$row->id target=_blank>".$fonts2."here</a></td>";
                 echo "<td align=center>".$fonts2."$row->klicks </td>";
                 $id = $row->id;
                 $query = "SELECT COUNT(id) AS total FROM comments WHERE dlid='$row->id'";
                 $result = mysql_query($query);

                 echo "<td>";
                 echo "$fonts2";
                 ?>
                 

                <?


                 echo "</tr>";
                 }
                 echo "</table>";
                aber dan kommt gar nichts...in der mysql tabelle werden die klicks gezählt in einer tabelle namens "klicks"

                kann mir da nochmal jmd weiterhelfen?

                Kommentar

                Lädt...
                X