Compare code for twice entries
<p>If i've database <code>my_table (id,word)</code> as following</p>

<p><img src="http://i.stack.imgur.com/wsX2s.png" alt="my_table (id,word)"></p>

<p>and i've some posted text called 
<code>$name</code> and <code>$comment</code> then i want to know if <code>$name</code> and/or <code>$comment</code> have any words like words i've stored in my database <code>my_table (id,word)</code></p>

<pre><code>$name = "Manal Nor";
$comment = "Hello lovely world";
</code></pre>

<p>I can now apply it for only one entry for example <code>$name</code></p>

<pre><code>$name = "Manal Nor"; // As example no bad words

$sql    = "SELECT * FROM my_table";
$result = mysql_query($sql);

$nameArray = explode(" ", $name);
$countname = count($nameArray);
$checkname = 0;

while ($row = mysql_fetch_assoc($result)) {

    for ($i=0;$i&lt;$countname;$i++) {

        if (strcasecmp($nameArray[$i], $row['word']) == 0) {
            $checkname = 1;
        }

    }

}

if ($checkname == 1) {
    echo "banned";
    exit;
}
else {
    echo "passed";
}
</code></pre>

<p>but <strong>now the question</strong> how to apply it for both <code>$name</code> and/or <code>$comment</code> so that i can give <code>echo "banned";</code> if either <code>$name</code> and/or <code>$comment</code> have any of the bad words in <code>my_table</code></p>
