compare between stored database rows and exact post
<p>I'm going to store some words inside db <code>my_table (id,word)</code> as follow</p>

<p><img src="http://i.stack.imgur.com/ZVLSg.png" alt="my_table"></p>

<p>Now i've input post </p>

<pre><code>$comment = $_POST[comment]; // "blab blah shit blah" have banned word (shit)
</code></pre>

<p>i want to do the following
if the comment contains any of the stored words inside <code>my_table</code> then it gives <code>echo "banned"; exit;</code> and if not then go on <code>echo "passed";</code></p>

<p>how then to compare it ?</p>

<p>is this could be right</p>

<pre><code>SELECT 1
FROM my_table
WHERE $comment LIKE CONCAT('%', my_table.word , '%')
LIMIT 1
</code></pre>

<p>then if gives results then echo <code>"banned";</code> and if not then <code>echo "passed"</code>; !</p>
