Electron affinity is the energy released when an element "picks up" an electron to give a negatively charged ion.
Ie Mg + e
- -> Mg
-The first ionisation energy is effectively the opposite. Ie it is the energy needed to remove (to an infinite distance) one electron to give a positively charged ion.
Eg Mg -> Mg
+ + e
-There is therefore no reason why the electron affinity should be related to the ionisation energy. The electron affinity (a thermodynamic quantity) is related (or at least follows the similar trends, generally) to the electronegativity of an element.
There are some very good on-line sources of info regarding these two, and related quantities. One that Google brought up was
http://chemed.chem.purdue.edu/genchem/topicreview/bp/ch7/ie_ea.html- but it still didn't give the answer to the EA for Mg!