Hypothetically, if I did not want the word "douche" to be anywhere in the username, and I have a table in my database with all the forbidden words ...
$q = "SELECT * FROM restrictions WHERE prohibited LIKE '%username%'";
$r = mysqli_query ($dbc, $q) or trigger_error("Query: $q\n<br />MySQL Error: " . mysqli_error($dbc));
if (mysqli_num_rows($r) !== 0)
{
//username is prohibited
echo "invalid";
}
else
{
...etc
The problem is that I donβt know how to execute a query that will receive partial matches (e.g. Jdoucher or douchebag4). I know that %% username% is obviously wrong. Does anyone know how to do this? Is it possible? Thank.
David source
share