Kod
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\inc\doctest.php on line 21[code]
[code]Query failed: SELECT upload_id, file_name, date AS d, title AS d, FROM uploads ORDER BY date_entered DESC - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM uploads ORDER BY date_entered DESC' at line 1
[code]Query failed: SELECT upload_id, file_name, date AS d, title AS d, FROM uploads ORDER BY date_entered DESC - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM uploads ORDER BY date_entered DESC' at line 1
<?php $query = "SELECT upload_id, file_name, ROUND(file_size/1024) AS fs, description, DATE_FORMAT(upload_date, '%M %e, %Y') AS d FROM uploads ORDER BY upload_date DDESC"; ?>
A całość wygląda tak
<?php $first = TRUE; //Initialize the variable. //query the db $query = "SELECT 'upload_id', file_name, ROUND(file_size/1024) AS fs, description, DATE_FORMAT(upload_date, '%M %e, %Y') AS d FROM uploads ORDER BY upload_date DDESC"; //Display all the URLs //If this is the first record then 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>'; } //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=\"center\">{$row['fs']}kb</td> <td align=\"left\">{$row['d']}</td> </tr>\n"; $first = FALSE; //one record has been returned } //End of while loop //If no records were displayed... if($first) { } else { } ?>