Jump to content

Not familiar with the following error


Xtremer360

Recommended Posts

I keep getting this error with this message: Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/content/y/a/n/yankeefaninkc/html/v3/index.php on line 114

 

<?php
	//query
			$query = "SELECT ecn.id AS id, ecn.title AS title, ecn.content AS content, ecn.postdate AS postdate FROM `efed_content_news` AS ecn WHERE ecn.public = '1' AND ecn.category_id = '3' ORDER BY ecn.postdate DESC, ecn.id DESC LIMIT 5";
			$result = mysql_query ($query);
			while($row = mysql_fetch_assoc($result)){
				$fieldarray=array('id','content','title','postdate');
				foreach ($fieldarray as $fieldlabel){
					if (isset($row[$fieldlabel])){ 
						$$fieldlabel=$row[$fieldlabel];
						$$fieldlabel=cleanquerydata($$fieldlabel);
					}
				}
				$postdate = convertdate($postdate);
				if($postdate != $olddate){
					if($olddate == ''){
						print "<li><strong>".$postdate."</strong><ul>";
					}
					else{
						print "</ul></li><li class='date'><strong>".$postdate."</strong><ul>";
					}
				}
				print "<li><a href='backstage/content.php?p=news&id=".$id."'>".$title."</a></li>";
				$olddate = $postdate;
			}
			print "</ul></li></ul>";
	?> 

Link to comment
https://forums.phpfreaks.com/topic/193740-not-familiar-with-the-following-error/
Share on other sites

it means that your call to mysql_query, failed and did not produce a result.

 

you need to check the response of th call to mysql_query and for now you should change it to

 

$result = mysql_query ($query) or die(mysql_error());

 

When you have resolved the issue and before this is used in a live environment you need to handle the error in a more sophisticated manner, but this will tell you what is wrong with your query

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.