Jump to content

[SOLVED] mysql_fetch_array error.


tomcommathe

Recommended Posts

I am getting the following error:

[29-Dec-2008 17:38:42] PHP Warning:  mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /Applications/MAMP/htdocs/fileuploads/download_file.php on line 16

 

From these lines of code:

if ($uid > 0) {
require_once ('../include/mysql_connect.php');

//Get info from file.
$query = "SELECT file_name, file_type, file_size, FROM uploads WHERE upload_id=$uid";
$result = mysql_query ($query);
list ($fn, $ft, $fs) = mysql_fetch_array ($result, MYSQL_NUM);

//Close connection
mysql_close();

 

Don't understand the problem. Help?

Link to comment
https://forums.phpfreaks.com/topic/138835-solved-mysql_fetch_array-error/
Share on other sites

Good call, it seems like this is the source of the trouble:

$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";

 

This is the error:

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 WHERE upload_id=7' at line 1

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.