一意の電子メールのみを取得するだけでなく、配送先の名前も表示しようとしています。
$sql=mysql_query("SELECT DISTINCT(email) As email FROM tbl_order");
while($row = mysql_fetch_array($sql))
{
echo " ".$row['shipping_name'].",".$row['email']." <br />";
}
しかし、配送先の名前は表示されません。
これを試して :
SELECT DISTINCT(email) As email,shipping_name FROM tbl_order" ;
正確なコードを提供するには:
$resultArray = array();
$sql=mysql_query("SELECT DISTINCT(email) as email,shipping_name FROM tbl_order");
$i = 0;
while($row = mysql_fetch_array($sql))
{
//echo " ".$row['shipping_name'].",".$row['email']." <br />";
$resultArray[$i]['shipping_name'] = $row['shipping_name'];
$resultArray[$i]['email'] = $row['email'];
$i++;
}
var_dump($resultArray);
$sql=mysql_query("SELECT DISTINCT(email) As email,shipping_name FROM tbl_order");
while($row = mysql_fetch_array($sql))
{
echo " ".$row['shipping_name'].",".$row['email']." <br />";
}