Ok, entonces aquí les dejo el código php que utilizo para mostrar las descargas:
Código PHP:
<?php
$path = __FILE__;
$path = preg_replace( "'\\\descargas\.php'", "", $path);
$path = preg_replace( "'/descargas\.php'", "", $path);
include("$path/downloads/config.php");
$sQuery = "SELECT*FROM downloads ORDER BY id DESC";
$sResult = MySQL_Query($sQuery);
$Rows = MySQL_Num_Rows($sResult);
$x = "1";
while ($Output = MySQL_Fetch_Array($sResult)) {
$Output = array_reverse($Output);
($x%2) ? $bg = "#000000": $bg = "#000000";
echo "<p style=\"margin-left: 8px; margin-right: 8px\"><b>".$Output['name']."<br> </b>";
echo"<table border=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" width=\"100%\" id=\"table1\">";
echo" <tr>";
echo" <td>";
echo"<p style=\"margin-left: 1px; margin-right: 1px\">";
echo"<a href=\"".$Output['picture']."\"><img src=\"".$Output['picture']."\" height=\"80\" width=\"80\" border=\"0\"></a></td>";
echo" <td style=\"color: #000000\">";
echo" <p style=\"margin-left: 1px; margin-right: 1px\">".$Output['description']."<br>";
echo"<br>";
echo" <b>";
echo" <a href=\"".$Output['download']."\">Descargar</a></b></td>";
echo" </tr>";
echo"</table>";
echo"<p style=\"margin-left: 8px; margin-right: 8px\">Subido por: ".$Output['username']."<br>";
echo"Autor: ".$Output['autor']."<br>";
echo"<font color=\"#000000\">___________________________</font>";
$x++;
}
?>
Y esto es donde se almacenan los campos en la BD despues de enviar el formulario html:
Código PHP:
<?php if($_POST['submit']){
$name = $_POST['name'];
$picture = $_POST['picture'];
$description = $_POST['description'];
$categoria = $_POST['categoria'];
$download = $_POST['download'];
$username = $_SESSION['username'];
$autor = $_POST['autor'];
include('config.php');
$query = mysql_query("INSERT INTO downloads VALUES ('null', '$name', '$picture', '$description', '$download', '$username', '$categoria', '$autor' )");
if($query){
echo "Tu descarga ha sido agregada con exito, sí quieres agregar más descargas porfavor ve a <a href=add.php>add page</a>";
}
else {
echo "Sorry! Please try again later.";
}
} ?>