you have a mistake in your sintax of $query2
you place array instead of actual value
change
$query2 = mysql_query("SELECT mail FROM `buyers` WHERE candysizeinterest IN ($result)
to
$query2 = mysql_query("SELECT `mail` FROM `buyers` WHERE `candysizeinterest` IN ('".$result['id_candy']."')");
I would like to also to remember you that mysql_
functions are deprecated so i would advise you to switch to mysqli
or PDO
for new projects.