error using compare code
<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> then i want to know if <code>$name</code> have any word like words i've stored in my database <code>my_table (id,word)</code></p>

<p>so i'm using this code </p>

<pre><code>$name = "Hello lovely world"; // no bad words

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

$commentArray = explode(" ", $name);
$counter      = count($commentArray);
$check        = 0;

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

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

        if (strcasecmp($commentArray[$i], $row['word'])) {
            $check = 1;
        }

    }

}

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

<p>however it always results in <code>echo "banned";</code> even if i <code>$name</code> is clear of any bad words i've stored in <code>my_table</code> so there might be something wrong here !</p>

<p>anyhelp</p>
