$found = false; $one = strpos($date, $search); $two = strpos($from, $search); $three = strpos($subj, $search); $four = strpos($message, $search); if ( 0 != $one+$two+$three+$four ) $found = true; if ($found) echo $tabled;