RE: [PHP] Checking for existing records[Scanned]
| From: | Michael Egan | Date: | Mon, 02 Jun 2003 13:50:09 +0000 |
| Subject: | RE: [PHP] Checking for existing records[Scanned] | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-149793@lists.php.net to get a copy of this message | ||
Thanks - I'll try to add these checks.
Life would be so much easier if it weren't for the users :-)
Michael Egan
-----Original Message-----
From: Jay Blanchard [mailto:jay.blanchard@niicommunications.com]
Sent: 02 June 2003 14:38
To: Michael Egan; PHP General (E-mail)
Subject: RE: [PHP] Checking for existing records[Scanned]
[snip]
When saving records to a table I generally do a fairly standard check to
ensure that there is not already a record of the same name. I even put
a big warning message on the page asking users to check to ensure that a
record of a particular name doesn't already exist before they create a
new record. But this hasn't stopped entries such as the following:
Record x: "The Prince's Trust"
Record y: "The Princes Trust"
Record z: "the Prince's Trust"
I know I won't be able to make any application entirely foolproof but
are there any steps I could use within the combination of MySQL and PHP
that might minimize such duplication?
[/snip]
Just some very quick thoughts....
Convert to either all uppers or all lowers (in the background) and check
againsts something done to the DB similarly. I would say that you could
do a LIKE query against the DB entries where the string length is
similar (a diff of one or two characters, but this could be really
innefficent and perhaps inaccurate. I am in the middle of trying to make
a LIKE query more efficient....it is a bear! Anyhow, that is some very
quick thoughts...
HTH!
Jay