Mysql没有返回任何错误,但没有给出任何结果,但在phpmyadmin中它返回

时间:2015-06-15 10:08:16

标签: php mysql

我有一个奇怪的错误。

当我运行这个sql:

select a.*, (((a.num_artigo NOT IN (select l.num_artigo from leiloes l))) | ((1 in (select n.RT from leiloes n where n.num_artigo = a.num_artigo)) << 1)) as TYPE from artigos_prazo a

在phpmyadmin中它返回一个应该是的表。

但是当我在php脚本中运行它时它不会返回任何内容,我也没有收到数据库中的错误。

    <?php
    $con = mysqli_connet...;
    $sql = "select a.*, (((a.num_artigo NOT IN (select l.num_artigo from leiloes l))) | ((1 in (select n.RT from leiloes n where n.num_artigo = a.num_artigo)) << 1)) as TYPE from artigos_prazo a";
        echo $sql;
        echo mysqli_error($con);
        $result = mysqli_query($con, $sql);
    print_r($result);
        while($row[] = mysqli_fetch_array($result));
    print_r($row);
mysqli_close($con)
    ?>

它连接到数据库......

请帮助

1 个答案:

答案 0 :(得分:0)

替换

while($row[] = mysqli_fetch_array($result));
print_r($row);

while($row = mysqli_fetch_array($result)) {
    print_r($row);
}