3){ $word = strtolower($words[$i]); $words = str_replace($f,$r,$words); $query2 = mysql_query("select word from searchWords where articleIds=".(int)$article['aid']); while($word_check = mysql_fetch_array($query2)){ //start while loop if($word_check['word']==$word){ $exists = TRUE; } //end check duplicates } //end while loop if(!$exists){ //check if exists mysql_query("INSERT INTO searchWords VALUES (0, '".$word."',".(int)$article['aid'].")") or die(mysql_error()); } } //end check if exists } //end for loop unset($words); unset($article); } print "Successful!"; print microtime() - $time; } populateKeywords(); ?>