I have a PHP script that logs queries on a search script into a MySQL database. However, If a query is put in for an inappropriate term I would not like it to be added to the database. I want a list of words that I deem to be inappropriate which is checked before adding the term to the database. How can I go about doing this?
My current PHP code is:
<?php
$query=$_GET['q'];
logQuery($query);
function logQuery($query){
$query="insert into queries (query) values ('$query') on duplicate key update value=value+1";
mysql_query($query);
}
?>
1 Answer