I am working on local project and cant figure out how to do this part. I just started
learning php and its hard for me to write a code from zero so i am looking for
some help here. I appreciate any help about this. Also apologize for my bad


Ok some info about what i want to create.
I have 2 mysql tables. Table1 contains name, sports they like, and number that
indicate how good they are at it. Table2 contains all the sport centers we have with
trainers name and their phone numbers.
I need to create table3 which takes persons sports from table1 but only those who
are in table2 ( e.g Tom can like tennis, but we don't have trainer for that) and
choose the one with the highest number. Then write to table3 person name, trainer
name of that sport, and phone number.

I hope i explained everything clear, if not ask me. I really need to get this working so thanks for help.
Here are the examples of the tables:

Name Sport Number
Tom Basketball 88
Tom Diving 48
Tom Driving 82
Tom Volleyball 82
Tom Tennis 99
John Volleyball 75
John Diving 76
Mike Tennis 65
Mike Basketball 70
Paul Football 92

Sport Contactperson Phone
Basketball Koby 865222111
Diving Tyler 655222444
Swimming Susan 874999555
Voleyball Megie 874333555
Box Tyson 800000000
Football Messi 899999999

Name Contactperson Phone
Tom Koby 865222111
John Tyler 655222444
Mike Koby 865222111
Paul Messi 899999999