How to display php array

Nicky

New Member
#1
This code will print result like this:
Mã:
test1@bnas.com.mytest2@bnas.com.my
So how can I separate the result in 2 variable like email[0],email[1]???
Mã:
$TEST='i192a';
$stid = oci_parse($conn, 'select email from BNS_NOTIFY_RECIPIENT where screen =:num0');     
oci_bind_by_name($stid, ':num0',$TEST);
oci_execute($stid);
$count = 0;
while (($row = oci_fetch_row($stid)) != false) {
    $EMAIL=$row[0];
    echo $EMAIL;
}
 

Admin

Administrator
Thành viên BQT
#2
Just make $email an array and push values into it on every pass through the loop. Then you can output (for example) a comma separated list using implode:
Mã:
$email = array();
while (($row = oci_fetch_row($stid)) != false) {
    $email[] = $row[0];
    // you could process each email here if you wanted to
}
// output comma separated list of emails
echo implode(',', $email);
 
Top