Sebastian
12-11-2002, 11:25 PM
greetings.
i am trying to get the date added to this snippet of code. I *believe* file_time table has the date info .. question is how do I fetch it along with the rest of the info? this script pulls the top10 newest files added to my download database, but i also want to get the date using file_time in format: D. M, j, Y .. any help?
<?php
$dbhostname= "blah";
$dbusername= "blah";
$dbpassword= "blah";
$dbdatabase= "blah";
$url= "./files/index.php";
$table ="filedb_files";
$listfiles= 10;
$db = @mysql_connect($dbhostname,$dbusername,$dbpassword );
if (!$db) {
echo( "<p>Unable to connect to the " .
"database server at this time.</p>" );
exit();
}
if (! @mysql_select_db($dbdatabase) ) {
echo( "<p>Error locating the file " .
"database at this time.</p >" );
exit();
}
$result = @mysql_query("SELECT file_id, file_name, file_dls FROM $table ORDER BY file_time DESC", $db);
if (!$result) {
echo("<p>Error performing query: " . mysql_error() . "</p>");
exit();
}
$files = mysql_num_rows($result);
echo "<b><u><center>Newest Files by Date</center></b></u><br>";
$i=1;
$r=0;
while (($myrow = mysql_fetch_row($result)) And ($i<=$listfiles)){
$r=$r + 1;
$i=$i + 1;
echo "$r - <a href='$url?action=file&id=$myrow[0]''><b>$myrow[1]</b></a> ( Downloaded $myrow[2] times )<br>\n"; }
echo "<br><br>\n";
?>
i am trying to get the date added to this snippet of code. I *believe* file_time table has the date info .. question is how do I fetch it along with the rest of the info? this script pulls the top10 newest files added to my download database, but i also want to get the date using file_time in format: D. M, j, Y .. any help?
<?php
$dbhostname= "blah";
$dbusername= "blah";
$dbpassword= "blah";
$dbdatabase= "blah";
$url= "./files/index.php";
$table ="filedb_files";
$listfiles= 10;
$db = @mysql_connect($dbhostname,$dbusername,$dbpassword );
if (!$db) {
echo( "<p>Unable to connect to the " .
"database server at this time.</p>" );
exit();
}
if (! @mysql_select_db($dbdatabase) ) {
echo( "<p>Error locating the file " .
"database at this time.</p >" );
exit();
}
$result = @mysql_query("SELECT file_id, file_name, file_dls FROM $table ORDER BY file_time DESC", $db);
if (!$result) {
echo("<p>Error performing query: " . mysql_error() . "</p>");
exit();
}
$files = mysql_num_rows($result);
echo "<b><u><center>Newest Files by Date</center></b></u><br>";
$i=1;
$r=0;
while (($myrow = mysql_fetch_row($result)) And ($i<=$listfiles)){
$r=$r + 1;
$i=$i + 1;
echo "$r - <a href='$url?action=file&id=$myrow[0]''><b>$myrow[1]</b></a> ( Downloaded $myrow[2] times )<br>\n"; }
echo "<br><br>\n";
?>