Skip to main content
Inspiring
March 28, 2007
Question

view files

  • March 28, 2007
  • 4 replies
  • 479 views
hey again. I had a error : mysql_fetch_array() which i got it solved, but when i open my view_files.php Text it doesn't show the file names.

This is my code, again: i dont know what could possibly be.

<?php # Script 12.9 - view_files.php
// This page displays the files uploaded to the server.

// Set the page title and include the HTML header.
$page_title = 'View Files';
include ('./includes/header.html');

require_once ('mysql_connect.php'); // Connect to the database.

$first = TRUE; // Initialize the variable.

// Query the database.
$query = "SELECT upload_id, file_name, ROUND(file_size/1024) AS fs, description, DATE_FORMAT(date_entered, '%M %e, %Y') AS d FROM uploads ORDER BY date_entered DESC";
$result = mysql_query($query) or die(mysql_error());

// Display all the URLs.
while($row = mysql_fetch_array ($result, MYSQL_ASSOC)) {

// If this is the first record, create the table header.
if ($first) {
echo '<table border="0" width="100%" cellspacing="3" cellpadding="3" align="center">
<tr>
<td align="left" width="20%"><font size="+1">File Name</font></td>
<td align="left" width="40%"><font size="+1">Description</font></td>
<td align="center" width="20%"><font size="+1">File Size</font></td>
<td align="left" width="20%"><font size="+1">Upload Date</font></td>
</tr>';

$first = FALSE; // One record has been returned.

} // End of $first IF.

// Display each record.
echo " <tr>
<td align=\"left\"><a href=\"download_file.php?uid={$row['upload_id']}\">{$row['file_name']}</a></td>
<td align=\"left\">" . stripslashes($row['description']) . "</td>
<td align\"center\">{$row['fs']}kb</td>
<td align=\"left\">{$row['d']}</td>
</tr>\n";

} // End of while loop.

// If no records were displayed...
if ($first) {
echo '<div align="center">There are currently no files to be viewed.</div>';
} else {
echo '</table>'; // Close the table.
}

mysql_close(); // Close the database connection.
include ('./includes/footer.html');
?>

thanks so much for all the help support
This topic has been closed for replies.

4 replies

Deaf_Web_Designer
Inspiring
March 28, 2007
No worries, Luis.

No one is perfect. We all, as human beings, make mistakes or forgot. So, no big deal, Luis.

But I know it might be of offending for some individuals out there, though.

Cheers, Brian (also known as DWD)
Inspiring
March 28, 2007
oh, i understand completly mate, i just didnt thing that anybody would actually go to me website .I respect everybody on this matter and i'll make sure from now on that i warn people in case.

Thanks again DWD
Deaf_Web_Designer
Inspiring
March 28, 2007
Hi Luis,

If I may chime in and make a quick suggestion, Luis., mind you? Por favor?

I didn't realize the content of your site is aimed for specific adult audience. Please try to keep that in mind, for those who are not familiar with your site, as I discovered just now and didn't know... so be sure to make a note of it, so participants will know right away or it might offend some of them, or not. It somewhat offends me, but no big deal.

It would be nice if there is a simple warning or such acknowledgement specifically intends for adult audience or something. you know better than me or others.

Thanks and have a good one, Luis.
Inspiring
March 28, 2007
I am so sorry, it surely wasn't my intention to offend you . You obviously must have typed my website just has the home domain address right?
i did put my from splash page with a warning before entering the page, but i will make sure that everytime i send a post here i add a note with a warning.
Accept my apologies Deaf. You are a good guy, never would offend you.
Inspiring
March 28, 2007
it is fixed. thank you so much. i had a '$' missing in my add_file.php and i had to change my download_file.php from this:
$the_file = '../uploads/' . $uid;

to this:
$the_file = 'uploads/' . $uid;

Its nerve breaking sometimes dealing with this codes, lol
Inspiring
March 28, 2007
i have just noticed by going to by database table 'uploads' that everything's there fine, but under there's nothing under 'file name'.
Is this normal ??
txs