<?php
echo "Connecting Database <br>";
$server = 'UKVDEMO03'; //Here you're server
$database = 'smtpFetch';//here the database you want to connect to
$user = 'shoaibsg';//here te user WHO HAS THE RIGHT PERMISSIONS AT THE DATABASE
$pass = '1111111';//and here the user's password
$dsn = "Driver={SQL Server};Server=$server;Database=$database;";
$connect = odbc_connect($dsn, $user, $pass);
echo "Successfully connected....";
//getting subscribe user detail
$subQuery="select emailAddress, dataSet from userDetail";
$subRes=odbc_exec($connect, $subQuery);
$ix=odbc_num_rows($subRes);
//$newArray[]=$newArray array;
$row[]=array();
$newArrayD[]=$row;
$i=0;
$xc=0;
if($ix>0)
{
while($row=odbc_fetch_array($subRes))
{
$newArrayD[$row['emailAddress']] =$row['emailAddress'];
$newArrayD[$row['dataSet']] =$row['dataSet'];
}
}
foreach($newArrayD as $arrayD)
{ $i++;
echo "<br> -" . $arrayD;
echo "-i increment -" . $i;
}
?>
上面显示下面的输出
-阵列 -shoaib@xyz.com -SSCRUS_CS2002 -nick@xyz.com -SSCE_CS2002
现在的问题:如果我只需要在 foreach 循环中只显示 emailAddress 它只显示第一个字符(我在下面的 foreach 循环中使用)
echo "<br> -" . $arrayD['emailAddress'];
如上面的输出显示为 - -s -S -n -S
我很困惑,请帮助