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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.