String concatenation by for loop

<?php
 $selstate= 'NY';
 $conn = $GLOBALS["Conn"];
 $sql = "SELECT `email`  FROM `users` WHERE `status` = 1 AND ( sub_state1 = '$selstate' OR sub_state2 = '$selstate' OR sub_state3 ='$selstate')";
 $rows = $conn->executeQuery($sql)->fetchAll();
 foreach ($rows as $row) {
    $sEmail_List =  $row['email'].',';
// echo  $sEmail_List;
 //var_dump( $sEmail_List);
 }
 //echo  $sEmail_List;
?>

this only show one email outside the loop.$email->Recipient = $sEmail_List; (i need all the email looped from the table)

vintoICT wrote:

$sEmail_List = $row[‘email’].‘,’;

Wrong string concatentation. Read String Operators.

Please try:

<?php
 $selstate= 'NY';
 $conn = $GLOBALS["Conn"];
 $sql = "SELECT `email`  FROM `users` WHERE `status` = 1 AND ( sub_state1 = '$selstate' OR sub_state2 = '$selstate' OR sub_state3 ='$selstate')";
 $rows = $conn->executeQuery($sql)->fetchAll();
 $sEmail_List = ""; // initial value
 foreach ($rows as $row) {
    $sEmail_List .=  $row['email'] . ",";
 }
 // don't forget to remove the last comma character
 $sEmail_List = rtrim($sEmail_List, ",");
?>

This worked perfectly . Thank you!