tomcommathe Posted December 30, 2008 Share Posted December 30, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/138835-solved-mysql_fetch_array-error/ Share on other sites More sharing options...
peranha Posted December 30, 2008 Share Posted December 30, 2008 Change your result line to this $result = mysql_query ($query) or die(mysql_error()); There is more and likely an error with the query. Quote Link to comment https://forums.phpfreaks.com/topic/138835-solved-mysql_fetch_array-error/#findComment-725956 Share on other sites More sharing options...
tomcommathe Posted December 30, 2008 Author Share Posted December 30, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/138835-solved-mysql_fetch_array-error/#findComment-725961 Share on other sites More sharing options...
tomcommathe Posted December 30, 2008 Author Share Posted December 30, 2008 Running MySQL 5.0.41 Quote Link to comment https://forums.phpfreaks.com/topic/138835-solved-mysql_fetch_array-error/#findComment-725966 Share on other sites More sharing options...
PFMaBiSmAd Posted December 30, 2008 Share Posted December 30, 2008 If you look at the right query, in the first post, you will notice an extra comma right before the point where the mysql_error() begins the error message. Quote Link to comment https://forums.phpfreaks.com/topic/138835-solved-mysql_fetch_array-error/#findComment-725969 Share on other sites More sharing options...
tomcommathe Posted December 30, 2008 Author Share Posted December 30, 2008 Thanks! Syntax will be the death of me... Now to figure out why I am getting no errors, but the script isn't functioning right. Quote Link to comment https://forums.phpfreaks.com/topic/138835-solved-mysql_fetch_array-error/#findComment-725975 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.