Please help.
I'm a novice coder, and the person I'm writing this for keeps changing his mind about what he wants.
I need to be able to check 3 different fields of tab-delimited text to eliminate duplicates in the echo results.
The code which is working successfully to do so on one field is:
$alreadyfounds = array(); # Clear what we've already found...
for ($mycount = 0; $mycount < $entiredbcount; $mycount++) {
if ($entiredb[$mycount][7] != "") {
$checkagainst = $entiredb[$mycount][7];
if (($alreadyfounds[$checkagainst] != 1) && ($checkagainst != ""))
{
echo "<TR><TD VALIGN=top>";
echo $entiredb[$mycount][6];
if (trim($entiredb[$mycount][6]) != "") {
echo " ";
}
echo $entiredb[$mycount][7];
echo "</TD>";
I need to be able to check field 6 and 7 together (i.e. 6 is Firstname, 7 is Lastname) and then really should also check field 20 (which is the URL if they have one) to eliminate duplicates only if the field is not blank.
Previously, I was using the following code to echo the record only if field 20 was not blank. (Those with no URL weren't listed at all...listing everybody is a newly requested feature!)
if ($entiredb[$mycount][20] != "") {
$checkagainst = $entiredb[$mycount][20];
if (($alreadyfounds[$checkagainst] != 1) && ($checkagainst != ""))
Now I need to list all individuals, whether or not they have a URL, and eliminate all duplicates based on a concatenation of fields 6 and 7 and also on field 20.
I'm now so confused, I don't know if there's any logic left here or not.
Let's say I have "John Day" whose URL is http://daylight.com/
Now, Good old John may also have a listing under "John Day, Esq." with the same URL as on his John Day listing.
Ideally, I want to list John and his URL only once. BUT... If John had a different URL with "John Day, Esq.", i.e. http://dayesq.com , then I'd need to echo both listings for dear John.
Can anyone help, or is this so far gone that I should just submerge my head in the neighbor's hot tub for 15-20 minutes????