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

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.