note 29221 added to function.similar-text
| From: | julius at infoguiden dot no | Date: | Thu, 06 Feb 2003 12:46:37 +0000 |
| Subject: | note 29221 added to function.similar-text | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-43511@lists.php.net to get a copy of this message | ||
If you have reserved names in a database that you don't want others to use, i find this to work
pretty good.
I added strtoupper to the variables to validate typing only. Taking case into consideration will
decrease similarity.
$query = mysql_query("select * from $table") or die("Query failed");
while ($row = mysql_fetch_array($query)) {
similar_text(strtoupper($_POST['name']), strtoupper($row['reserved']),
$similarity_pst);
if (number_format($similarity_pst, 0) > 90){
$too_similar = $row['reserved'];
print "The name you entered is too similar the reserved name
"".$row['reserved'].""";
break;
}
}
--
http://www.php.net/manual/en/function.similar-text.php
http://master.php.net/manage/user-notes.php?action=edit+29221
http://master.php.net/manage/user-notes.php?action=delete+29221
http://master.php.net/manage/user-notes.php?action=reject+29221