im trying to make a news page but i get this error
Warning: mysql_result() expects parameter 1 to be resource, boolean given in D:\News\Index.php on
line 37
and this is the code
$category = mysql_query("SELECT icon FROM website.catnews WHERE ncatid=\'". mysql_real_escape_string($news['category']). '\'');
echo '<td>
<td><a href = "news.php?cat='. $news['category'].'"><img src="./img/'.mysql_result($category, 'icon').'" alt="" /></a></td>';
and this is the whole source in mssql
<br />
<table style="width: 100%;">
<tr>
<td></td>
<td id="key">Title</td>
<td id="key" style="text-align: center;">Author</td>
<td id="key" style="text-align: center;">Comments</td>
<td id="key" style="text-align: center;">Views</td>
<td id="key" style="text-align: center;">Date</td>
</tr>
<?php
odbc_exec($mssql, 'USE [WEBSITE_DBF]');
$count = odbc_exec($mssql, 'SELECT COUNT(*) as count FROM [web_news]');
if(odbc_result($count, 'count') > 0) {
$query = odbc_exec($mssql, 'SELECT TOP 10 * FROM [web_news] ORDER BY datetime DESC');
while($news = odbc_fetch_array($query)) {
$title = $news['title'];
if(strlen($title) > 35) {
$title = substr($title, 0, 35).'...';
}
$comments = odbc_exec($mssql, 'SELECT COUNT(*) as count FROM [web_newscomments] WHERE nid=\''.mssql_escape_string($news['nid']).'\'');
$category = odbc_exec($mssql, 'SELECT icon FROM [web_newscategories] WHERE ncatid=\''.mssql_escape_string($news['category']).'\'');
echo '<tr>
<td><a href="news.php?cat='.$news['category'].'"><img src="./img/'.odbc_result($category, 'icon').'" alt="" /></a></td>
<td><a href="news.php?nid='.$news['nid'].'">'.$title.'</a></td>
<td style="text-align: center;">'.$news['author'].'</td>
<td style="text-align: center;">'.odbc_result($comments, 'count').'</td>
<td style="text-align: center;">'.$news['views'].'</td>
<td style="text-align: center;">'.date('Y-m-d', strtotime($news['datetime'])).'</td>';
}
} else {
echo 'No news available!';
}
?>
</table>