sleepnot Posted April 16, 2012 Share Posted April 16, 2012 this Nofications appear.. Notice: Undefined index: id in C:\wamp\www\WAR\up3\view.php on line 4 Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in C:\wamp\www\WAR\up3\view.php on line 9 invalid id this is my code. <?php require ('dbconnect.php'); // Connect to database $id = $_GET['id']; // ID of entry you wish to view. To use this enter "view.php?id=x" where x is the entry you wish to view. $query = "SELECT data, filetype FROM uploads where uploadid=$id"; //Find the file, pull the filecontents and the filetype $result = MYSQL_QUERY($query); // run the query if($row=mysql_fetch_row($result)) // pull the first row of the result into an array(there will only be one) { $data = $row[0]; // First bit is the data $type = $row[1]; // second is the filename Header( "Content-type: $type"); // Send the header of the approptiate file type, if it's' a image you want it to show as one print $data; // Send the data. } else // the id was invalid { echo "invalid id"; } ?> Link to comment https://forums.phpfreaks.com/topic/261015-help-warning-mysql_fetch_row-expects-parameter-1-to-be-resource/ Share on other sites More sharing options...
gizmola Posted April 16, 2012 Share Posted April 16, 2012 A cascade of failure: - The script did not find a url parameter named 'id'. - Thus the query is not valid - Thus $result is false rather than a result set - Thus you can not fetch Link to comment https://forums.phpfreaks.com/topic/261015-help-warning-mysql_fetch_row-expects-parameter-1-to-be-resource/#findComment-1337715 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.