Jump to content

Supplied Argument Is Not A Valid Mysql Result Resource


bigjoe11a

Recommended Posts

well I been playing with this for 3 days and I still get the same error. I went over the code 20 + times and still can't find an error. can some one please help. I will have a comment where I get the error at.

    $mysql = new Mysql(); $mysql->connect(db_host, db_name, db_user, db_pass); // change this line here$query = "";if (!isset($_POST['maptype']) || empty($_POST['maptype'])) {    $query = "SELECT * FROM ".db_prefix."maps WHERE category='".$c."'";    echo '<br />Your viewing all records for '.$category[$c].'<br />';} else if(isset($_POST['maptype'])) {  //$maptype = ;    $query = "SELECT * FROM '".db_prefix."maps' WHERE category='".$c."' AND maptype='".$_POST['maptype']."'";    echo '<br />Your viewing '.$maptypes[$_POST['maptype']].' for '.$category[$c].'<br />';    unset($_POST['maptype']);     } else {    echo 'Error getting maps.<br />';    exit();}

//if ($mysql->GetRows($query) >= 1) {    if ($mysql->GetRows($query) >= 1) { // I get the error here and	    while ($two = $mysql->fetchArray($query) >= 1) // I all so get the same error here too.	    //foreach (mysql_fetch_assoc($query) as $row)	    {  		    $page = new page('sources/mapview.html');		    $page->replace_tags(array(		    'FILEID'		 => $row['id'],		    'POSTEDBY'	   => $row['username'],		    'TITLE'		  => $row['title'],			 'DATEPOST'	   => $row['postdate'],		    'FILENAME'	   => $row['filename'],		    'MAPTYPE'	    => $row['maptype'],		    'FILESIZE'	   => $row['filesize'],		    'FILETYPE'	   => $row['filetype'],		    'CATEGORY'	   => $row['category'],		    'MAPREQUIRES'    => $row['maprequire'],		    'MAPIMAGE'	   => $row['image'],		   		    'TOTALCOM'	   => '0', //DataManager->GetTotalCom($row['id']),			   'TOTALDLS'	   => '0', //DataManager->Gettotaldls($row['id']),		    'DESX'		   => '<textarea rows=3 cols=40>'.$row['desx'].'</textarea>', 		    ));		    $page->output();	    }} else { echo "Sorry, No maps here, Add some today<br />"; echo "<a href='upload.php?c=".$c."'>Add Map</a><br />";}

Link to comment
Share on other sites

The error is saying is that you are not passing an expected argument to those methods. It expects you to have already made the query which in return would have returned a result set (i.e. resource), for which you could use with GetRows, etc. Right now you are just giving it a string. You need to "execute" that string prior to using it further. check out the tutorialshttp://www.w3schools.com/php/php_mysql_select.asp

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...