Downloads zählen ....

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

  • Downloads zählen ....

    Hallo zusammen !!

    Und zwar habe ich ein Problem.
    Ich will wenn man auf die .zip Datei klickt einen Counter in der Datenbank erhöhen.

    Ich weiss aber leider nicht mehr weiter.
    Hier ist der Code:

    <?php

    if($akt == ""){
    $akt = 0;
    }
    if ($show == "w"){
    $akt = $akt + 5;
    }
    if ($show == "z"){
    $akt = $akt - 5;
    }

    $result = mysql_query("SELECT * FROM flash_mix WHERE kat='$kat' ORDER BY bild DESC LIMIT $akt,5")
    or die("Konnte Daten nicht laden");

    $counter = 1;

    while($row = mysql_fetch_array($result)){
    $counter++;
    ?>
    <link rel="stylesheet" href="/mario/funnypage/styles/style.css" type="text/css">
    <body topmargin="0">
    <br>
    <table class="table_download" cellspacing="0" cellpadding="0" align="center">
    <tr bgcolor="#CCCCCC">
    <td colspan="2">
    <table class="tabledownload_klein" cellspacing="0" cellpadding="0" bgcolor="#3399FF">
    <tr>
    <td height="20"> &nbsp;&nbsp;&nbsp;
    <?php print $row["titel"]?>
    </td>
    <td height="20">
    <div align="right">Nr.
    <?php print $row["bild"]?>
    &nbsp;</div>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td width="79"><img src="/mario/funnypage/funsector/flash_mix/<?php print $row["kat"]?>/<?php print $row["bild"]?>.jpg" class="thumb_download" alt=<?php print $kat;?>></td>
    <td valign="top" width="279"> Beschreibung folgt...</td>
    </tr>
    <tr>
    <td colspan="2">
    <table class="tabledownload_klein" cellspacing="0" cellpadding="0" bgcolor="#3399FF">
    <tr>
    <td height="20">
    <div align="center" height="20">Gr&ouml;sse:
    <?php print $row["groesse"]?>
    </div>
    </td>
    <td height="20">
    <div align="center" height="20">Downloads:
    <?php print $row["counter"];?>
    </div>
    </td>
    <td height="20">
    <div align="center" height="20"><a href="/mario/funnypage/funsector/flash_mix/<?php print $row["kat"]?>/<?php print $row["bild"]?>.zip">Hier
    gehts zum Download</a></div>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    </table>
    <br>
    <br>
    <?php }
    ?>

    <br>
    <table align="center">
    <tr>
    <td><?php if ($akt != 0){?>
    <a href="?funsector=flash_mix&kat=<?php print $kat; ?>&show=z&akt=<?php print $akt; ?>">Zurück</a><?php }?></td>
    <td><?php if (mysql_num_rows($result) == 5){?>
    <a href="?funsector=flash_mix&kat=<?php print $kat; ?>&show=w&akt=<?php print $akt; ?>">Weiter</a><?php }?></td>
    </tr>
    </table>

    <br>
    <br>
    <br>
    <?php mysql_free_result($result);?>
    [color=blue]Liebe Grüsse und einen schönen Tag wünscht, Mario[/color]
    LOVE, & PEACE all over the World

  • #2
    Es bringt nichts,einfach nur $counter++ zu setzen.Du musst den Wert ja auch speichern.Am besten machst du eine eigene Tabelle.
    Code:
    mysql_query("CREATE TABLE counter
    counter int NOT NULL");
    Und immer wenn du den Counter einen hochsetzten willst,machst du das:
    Code:
    mysql_query("UPDATE counter SET counter='counter+1'");
    Das war's schon

    Kommentar

    Lädt...
    X