0

试图只获得唯一的电子邮件,但也显示运输名称。

$sql=mysql_query("SELECT DISTINCT(email) As email FROM tbl_order");
while($row = mysql_fetch_array($sql))
{
echo " ".$row['shipping_name'].",".$row['email']." <br />";
}

但它没有显示运输名称,任何帮助都会很棒,非常感谢。

4

4 回答 4

1

尝试这个 :

SELECT DISTINCT(email) As email,shipping_name FROM tbl_order" ;
于 2013-11-05T11:36:17.660 回答
0

做这个

("SELECT DISTINCT(email) AS email, shipping_name FROM tbl_order")

或者

("SELECT email, shipping_name FROM tbl_order GROUP BY email")
于 2013-11-05T11:33:33.347 回答
0

给你确切的代码:

$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);
于 2013-11-05T11:40:06.693 回答
0
 $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 />";
}
于 2013-11-05T12:14:52.960 回答