Do the same thing for the MgCl2 solution.
When the solution is prepared, what species are present in solution.
Then, as the electrolysis is performed what compounds have a possibility of being formed.
Of those compunds, what forms a milky white precipitate suspended in the water, but most likely something to do with Mg.
Note that for the NaCl solution you still have to decide which one compound has formed the browniish residue, instead of a brownish liquid, which since you say residue is not soluable in water.
You still have some more research to do.
Come back if you have some more questions.
Sorry if I appear to be vague but you trying to find out what the precipitates are will give you tremendous insight into chemical reactions.