Hi all!
I'm having problems with a search script that I'm using.

The search table stores keywords from a description found in another table and the ID of that table. The script searches in the description table to determine whether new IDs have been added in the description table, if so the keywords of the description are added to the search table.
Having done this, the search script now searches for the querystring entered by the user.

The part of the script giving trouble is the portion that searches for new IDs in the description table. I think the problem arises with duplicate entries for the keyword and ID.....so to fix it, I added a bit of code to not enter keywords already entered for that ID....
but no luck!

I'm including the code where I get my error messages, as well as the error messages displayed....someone pleaseeee help!

PHP Code:
//select max item id in search table, 
//to determine whether we need to update this table
$querymax "SELECT MAX(ItemID)
             FROM search_table"
;
$resultmax mysql_query($querymax)        
    or die(
"<p>Error performing query: " mysql_error() . "</p>");  
    
$maxid mysql_result ($resultmax'ItemID'0);

//select min item id in bidinfo table,
//to determine which search results are outdated
//and delete them form search table
$querymin "SELECT MIN(ItemID)
             FROM BidInfo"
;
$resultmin mysql_query($querymin)        
    or die(
"<p>Error performing query: " mysql_error() . "</p>");  
    
$minid mysql_result ($resultmin'ItemID'0);

$delete "DELETE FROM search_table
           WHERE ItemID < '
$minid'";
$resultdelete = @mysql_query($delete);
    
//select all those items not in seacrh table, that are up for auction
$query "SELECT ItemID, ItemName, ItemDescript 
          FROM ItemInfo
          WHERE ItemID > '
$maxid'"
$result mysql_query($query
    or die(
"<p>Error performing query: " mysql_error() . "</p>");  

while ( 
$row = @mysql_fetch_array($result) ) 
{

    
$body $row['ItemName'];
    
$body .= $row['ItemDescript'];

    
$id $row['ItemID']; 

    
/* Open the noise words into an array */ 

    
$noise_words file("C:/Apache/htdocs/MyAuction/noisewords.txt"); 
    
$filtered $body

    
$filtered ereg_replace("^"," ",$filtered); 

    for (
$i=0$i count($noise_words); $i++) { 
        
$filterword trim($noise_words[$i]); 
        
$filtered eregi_replace($filterword "," ",$filtered); 
    } 
//echo $filtered;
    
$filtered trim($filtered); 
    
$filtered addslashes($filtered); 
    
$querywords ereg_replace(",","",$filtered); 
    
$querywords ereg_replace(" ",",",$querywords); 
    
    
$eachword explode(","$querywords);

    for (
$k=0$k count($eachword); $k++) 
    { 
        
$countquery "SELECT COUNT(ItemID)
                       FROM search_table
                       WHERE ItemID = '
$id'
                       AND word = '
$eachword[$k]'";
        
$countresult = @mysql_query($countquery);
            
        
$countvalue mysql_result($countresult,'ItemID'0);//here's where the problema occurs
        
        
if ($countvalue == 0
        {
            
$inputword "INSERT INTO search_table 
                             VALUES(
$eachword[$k],$id)"
            
$result = @mysql_query($inputword)
                or die(
"<p>Error performing query: " mysql_error() . "</p>");
        }
        
         
    } 
And here're the error messages:
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in c:\apache\htdocs\myauction\viewsearch.php on line 167

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in c:\apache\htdocs\myauction\viewsearch.php on line 167

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in c:\apache\htdocs\myauction\viewsearch.php on line 167

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in c:\apache\htdocs\myauction\viewsearch.php on line 167

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in c:\apache\htdocs\myauction\viewsearch.php on line 167
Error performing query: Duplicate entry '82-Rolex' for key 1

Shivi