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

标签 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)
    ?>

它连接到数据库...

请帮忙

最佳答案

替换

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

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

关于php - Mysql 没有返回错误,但没有给出任何结果,但在 phpmyadmin 中它返回,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30842476/

相关文章:

mysql - 使用其他行的 SUM() 和 COUNT() 更新一行

mysql - MySQL如何知道是否有已经锁定的表

php - 将 2 个 Mysql 查询组合成 1 个(有效方式)

php - 在文本区域输入字段中显示换行符

php - 如果MySql行(字段)有任何文本输出

php - mysql_fetch_array 不适用于 1 行查询结果

mySQL 从不同的表中选择列

javascript - Jqgrid无法添加或编辑数据

PHP PDO 函数 lastInsertId 和竞争条件

mysql - Drupal 数据库 API 增量