field relationship function


I have a mysql table as follows:


| Field | Type | Null | Key | Default | Extra |


| email | varchar(50) | YES | | NULL | |

| source | varchar(50) | YES | | NULL | |


I need a function which takes an two email addresses as parameters, and returns the "distance" between them.

Not sure but i think backtracking might solve this.

I'm paying $30 for the PHP function. I need it within 1-2 hours after I award the project.

Please dont waste my time!

Each "source" email address is an user of ours, who is using a contact importer to import their contacts. All imported contacts go in the "email" column.

Now, each of these imported emails may also import other contacts, and so on.

We need the function to be able to tell how many contacts away a source email is from another particular email, so we can display something like:

You are connected to ABC@domain.com through:
A@domain1.com > B@domain2.com > ..... > N@domainN.com

I can't explain any better than this. If it's still not clear, please withdraw bid.

Update: i just tried backtracking and it breaks the database. We need this to work without hanging mysql when dealing with 100 000 + contacts.

Here is some recursive code that just displays if a match was found. Again, this breaks the database if we try with around 100,000 contacts in the table.

It needs to display the PATH to a contact or NO MATCH.

function find($start,$end) {

$res=mysql_query("select * from contacts where source='".$start."'");

while ($row=mysql_fetch_array($res))
if ($row['email']==$end) {
print "found!rn";
print "Trying ".$row['email']."rn";

Evner: PHP

Se mere: it field, php function , null, function, field php, backtracking, extra email, function time, returns email, mysql distance, distance table, distance project, mysql field, solve within, distance addresses, need null, php field mysql, paying email, mysql table field php, mysql php field, function project, field php, field mysql php, php function time, distance mysql

Om arbejdsgiveren:
( 20 bedømmelser ) Paris, France

Projekt ID: #301834

Tildelt til:


Hi, please check PM. Thanks

$30 USD in 0 dage
(252 bedømmelser)

2 freelancere byder i gennemsnit $30 på dette job


Please check your pm

$30 USD in 0 dage
(8 bedømmelser)