Banned words application using database table
<p>I'd like to store certain words inside database table to be banned but i can not apply it.</p>

<p>as follow
1 - Created simple form to input the words to be banned (ban.php)</p>

<pre><code>&lt;form name="form" method="post" action="add.php"&gt;
&lt;input type="text" name="bad" id="bad"&gt;
&lt;input type="submit" name="submit" id="submit" size="12" value="submit"&gt;
&lt;/form&gt;
</code></pre>

<p>2 - Now will post it through db (add.php)</p>

<pre><code>&lt;?PHP
require_once("config.php"); // db conn
$bad = $_POST['bad'];
$bad = mysql_real_escape_string($bad);

$sql= "insert into my_table set bad='$bad'";
mysql_query($sql, $conn) or die(mysql_error());

echo "Done bad word added";
?&gt;
</code></pre>

<p>3- Now how to apply it ! <strong>this is my question</strong>
Let say we've banned the word <code>ugly</code>
now i wanna do this application</p>

<pre><code>&lt;?PHP
require_once("config.php"); // db conn
$qry="select * from my_table";
$result=mysql_query($qry) or die($qry);

$test ="ugly"; // Example

if ($test == any of the words in the db my_table){
echo "banned";
}else{
echo "passed";
{
?&gt;
</code></pre>

<p>how to do this ! as we imagine we've many many added words in <code>my_table</code> </p>

<pre><code>id,bad (1,'ugly')
id,bad (2,'sick')
id,bad (3,'manal')
id,bad (4,'fog')
</code></pre>

<p>~ thanks</p>

<p>The same question is my question . If i have above table how can i check these words in my posted comment . </p>

<p>Kindly help me out ASAP on this same question .</p>
