RE: [PHP] Array newbie
| From: | Krznaric Michael | Date: | Fri, 04 Aug 2000 17:43:00 +0000 |
| Subject: | RE: [PHP] Array newbie | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-10170@lists.php.net to get a copy of this message | ||
David,
I know understand your problem however I'm still not sure what type
of SQL statement you are using. There doesn't seem to be any clear relation
between spam name, spam address and spam city. However the least you can do
is
SELECT reference
FROM spam_name
WHERE (some condition, eq. WHERE s_last = 'Bob')
If you are worried about matching too many matched. You may also try
SELECT COUNT(*)
FROM spam_name
WHERE (some condition)
This will give you the number of rows that match your condition and you may
then decided wheter or not to proceed with that particular approach. Also I
believe there is a php function which will give you the number of rows
affected by your query.
I may be telling you things you already know. One thing to keep in
mind, SQL is a very powerfull and simple language that will shif the
searching burden onto the database instead of your script. Remember the
dabatase is optimized and will return your result much quicker they you
would in a simple script.
Mike.
-----Original Message-----
From: David VanHorn [mailto:dvanhorn@cedar.net]
Sent: Friday, August 04, 2000 12:29 PM
To: Krznaric Michael
Subject: RE: [PHP] Array newbie
At 12:05 PM 8/4/00 -0400, Krznaric Michael wrote:
>David,
>
> I'm not sure how familiar you are with SQL, but I suspect that
your
>problem can be adressed with an sql statement. Can you maybe elaborate on
>what your desired end result is after you have these references and as to
>how they're organized in the database?
Ok,
I have a database of people who have abused ISPs by various methods,
including spamming.
top_spam_report contains various admin information.
Tied to reference are:
spam_name {reference, first, mi, last, mf, s_first, s_last}
spam_address {reference, number, street, phone, unit, s_street}
spam_city {reference, city, state, zip, country, s_city}
The "s_" records are soundexed versions, to limit my search results.
At this point, I look for names by pulling all that match s_first and
s_last, then look through returned list for literal matches to first and
last.
On address, I pull all with s_street, then look for literals on street
Same with city, state, and zip.
The problem with all this, is that I'm not matching up someone who wants to
be matched up.
They may lie about parts of this information, so I'm working to find the
most efficient way to derive partial matches, and to express my confidence
in those matches.
Obviously a full literal match is good, but "bob" may sign on as "robert"
next time.
Soundex gets that, and if address and CSZ match, then it's a highly likely
hit.
If address matches, but city and state don't then it's not so likely..
--
Where's dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9