This should be above the email code:
<?php
if(isset($_POST["us_alias"]) && $WA_DFP_UploadStatus["WA_UploadResult1"]["statusCode"] == 1) {
foreach($_POST["us_alias"] as $clave=>$valor){
?>
<?php
$rsMail = new WA_MySQLi_RS("rsMail ",$conexion_i,0);
$rsMail ->setQuery("SELECT * FROM usuarios_pml WHERE usuarios_pml.us_nombre = ?");
$rsMail ->bindParam("s", "".$valor ."", "-1"); //noparam
$rsMail ->execute();
?>
and this should be below it:
<?php
}
}
?>