0

i have a ver starbge problem , i was making a site and was completly correct on the localhost,but when i upload irt to a server to test it something stange happened which is i got that error
Warning: mysql_result() expects parameter 1 to be resource, boolean given in /home/saraanv/public_html/blog_web/index.php on line 10

this is the code part which has the error , any help plzz?

<?php 
		
		include 'config.php';
		$q="select * from `topic` order by `id` desc";
		$result=mysql_query($q);
		echo "<table>";
		for ($i=0;$i<8;$i++)
		{
			echo "<tr>";
			$topic_id=mysql_result($result,$i,'id');
			$topic_name=mysql_result($result,$i,'title');
			$num_char=strlen($topic_name);
			//echo $num_char;
			if ($num_char>25)
			{
				
				echo "<td>";
				echo "<a href='show_topic.php?id=$topic_id'>";
				echo "<font color='#002248' face='Times New Roman, Times, serif' size='2'>";
			    echo substr($topic_name,0,30);
			    echo "</font>";		
				echo "</a>";
				echo "......";
				echo "</td>";
				
			}
			else 
			{
				echo "<td>";
				echo "<a href='show_topic.php?id=$topic_id'>";
				echo "<font color='#002248' face='Times New Roman, Times, serif' size='2'>";
			    echo $topic_name;
			    echo "</font>";		
				echo "</a>";
				echo "</td>";
			}
                echo "<td>";
				echo "<a href='show_topic.php?id=$topic_id'>";	
				echo "<img src='images/Plus.png' height='20' width='20' align='left' border='0' />";
				echo "</a>";
				echo "</td>";
				echo "</tr>";
				
		}
	echo "</table>";
		?>

Edited by sara nabil: n/a

3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by sara nabil
0

i meam line 10 not 111 , which has the follwing statement
$topic_id=mysql_result($result,$i,'id');
, but there is no output only these warning

0

Hi sara nabil,

I had a similar error when running multiple mysql_result statements on the same variable ($result).
Try resetting the file pointer between the statements (line 10 and 11).

$topic_id=mysql_result($result,$i,'id');
mysql_data_seek($result,'0');
$topic_name=mysql_result($result,$i,'title');

Hope this helps.
Zagga

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.