PHP MYSQL UNION不显示结果

时间:2014-02-23 09:35:43

标签: php mysql union

    $sql = "SELECT * FROM computers WHERE order_no = '$odn' UNION SELECT * FROM keyboard WHERE order_no = '$odn'";
        $sqlresult = mysql_query($sql);
        while($sqlrow = mysql_fetch_assoc($sqlresult)){
            $retrieveordersubjectlevelsarray[] = $sqlrow;
        }
        print_r($retrieveordersubjectlevelsarray);

伙计我有上面的代码从2个表中检索相同的订单号。当我print_r结果时,它不显示计算机表和键盘中的行。当我删除union语句变为如下所示时,它将仅显示计算机表中的行。怎么解决这个问题?

$sql = "SELECT * FROM computer WHERE order_no = '$odn'";

0 个答案:

没有答案