Guest User

php tabelle

a guest
Apr 9th, 2014
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.53 KB | None | 0 0
  1. ...
  2. <body>
  3. <div id="site">
  4. <?php include "nav.php"; ?>
  5. <div id="content">
  6. <b>Neu hochgeladen</b>
  7.  
  8. <?php
  9. $db_host = "127.0.0.1";
  10. $db_user = "root";
  11. $db_pass = "";
  12. $db_name = "login";
  13. $conID = mysql_connect( $db_host, $db_user, $db_pass ) or die( "Die Datenbank konnte nicht erreicht werden!" );
  14. if ($conID)
  15. {
  16.     mysql_select_db( $db_name, $conID );
  17. }
  18.  
  19. $sql = "SELECT * FROM files ORDER BY id DESC LIMIT 10;";
  20.  
  21. $abfrageergebnis = mysql_query( $sql, $conID );
  22.  
  23. echo '<table border = "0">';
  24. echo "<tr>";
  25. echo '<td width="150" bgcolor="#d0e3f4"><font size="1"><center>Filename</center></font></td>';
  26. echo '<td width="60" bgcolor="#d0e3f4"><font size="1"><center>Category</center></font></td>';
  27. echo '<td width="60" bgcolor="#d0e3f4"><font size="1"><center>Date</center></font></td>';
  28. echo '<td width="40" bgcolor="#d0e3f4"><font size="1"><center>Link</center></font></td>';
  29. echo '<td width="70" bgcolor="#d0e3f4"><font size="1"><center>Size</center></font></td>';
  30. echo "</tr>";
  31.  
  32. while ($datensatz = mysql_fetch_array( $abfrageergebnis ))
  33. {
  34.     echo "<br>";
  35.     echo "<tr>";
  36.     echo '<td bgcolor="#ababab"><font size="2">' .$datensatz['filename']. '</font></td>';
  37.     echo '<td bgcolor="#ababab"><font size="2"><center>' .$datensatz['category']. '</center></font></td>';
  38.     echo '<td bgcolor="#ababab"><font size="2"><center>' .$datensatz['date']. '</center></font></td>';
  39.     echo '<td bgcolor="#ababab"><center>';
  40.    
  41.     if($datensatz['type'] == "pdf")
  42.     {
  43.         echo '<a href="upload/'.$datensatz['category'].'/'.$datensatz['filename'].'"><img src="icons/pdf.png" height="20" width="20"></a>';
  44.     }
  45.    
  46.     if($datensatz['type'] == "rar")
  47.     {
  48.         echo '<a href="upload/'.$datensatz['category'].'/'.$datensatz['filename'].'"><img src="icons/rar.png" height="20" width="20"></a>';
  49.     }
  50.    
  51.     if($datensatz['type'] == "txt")
  52.     {
  53.         echo '<a href="upload/'.$datensatz['category'].'/'.$datensatz['filename'].'"><img src="icons/txt.png" height="20" width="20"></a>';
  54.     }
  55.    
  56.     if($datensatz['type'] == "doc" || $datensatz['type'] == "docx")
  57.     {
  58.         echo '<a href="upload/'.$datensatz['category'].'/'.$datensatz['filename'].'"><img src="icons/word.png" height="20" width="20"></a>';
  59.     }
  60.    
  61.     if($datensatz['type'] == "zip")
  62.     {
  63.         echo '<a href="upload/'.$datensatz['category'].'/'.$datensatz['filename'].'"><img src="icons/zip.png" height="20" width="20"></a>';
  64.     }
  65.    
  66.     echo '</center></td>';
  67.     echo '<td bgcolor="#ababab"><font size="2"><center>'.$datensatz['size'].' KB</center>';
  68.     echo "</tr>";
  69. }
  70.  
  71. echo "</table>";
  72.    
  73. mysql_close($conID);
  74. ?>
  75.  
  76. </div>
  77. </div>
  78. </body>
  79. ...
Advertisement
Add Comment
Please, Sign In to add comment