hi i am trying to write a method to see whether the word 'not' appears before a positive or negative word then i want to +1 to the negative count and -1 from the negative count any idea how to do this, i already a 2 methods which count how many times the positive and negative words appear

// Gets the positive words and check for the word in the text  
while($check = mysql_fetch_assoc($pos)){
  $lower = mb_strtolower($check['word']);
 if(isset($cnt_r[$lower])){
	$good+= $cnt_r[$lower];
   	echo "<p>" . $check['word'] . "</p>";
    $review_text = preg_replace("/\b{$check['word']}\b/", "<span class=\"goodword\">{$check['word']}</span>" , $review_text);
	} 
}

// Gets the negative words and check for the word in the text 
while($check = mysql_fetch_assoc($neg)){
  $lower = mb_strtolower($check['word']);
 if(isset($cnt_r[$lower])){
	$bad+= $cnt_r[$lower];
  	echo "<p>" . $check['word'] . "</p>";
    $review_text = preg_replace("/\b{$check['word']}\b/", "<span class=\"badword\">{$check['word']}</span>" , $review_text);

	} 
 }