PHP显示表中的图像 - 将查询从Mysql更改为Mysqli

时间:2016-07-26 19:00:10

标签: php mysql image mysqli

我正在尝试将我发现的旧的php查询转换为mysqli,但是我总是得到'数据库中没有图像'错误。

我已经仔细检查了我的SQL并对数据库进行了测试,并将对mysql的所有引用更改为mysqli。有人可以帮忙吗?

<?php
    require( '../connect_db.php' ) ;
    $pull_images = mysqli_query("
        select 
        dbo_infoseek_source.id, 
        dbo_infoseek_source.fulltitle,
        dbo_infoseek_source_additionals.url
        from dbo_infoseek_source, dbo_infoseek_source_additionals
        where dbo_infoseek_source_additionals.type = 'In-game screen'
        and dbo_infoseek_source.id = dbo_infoseek_source_additionals.id
        and dbo_infoseek_source.type = 'Arcade: Adventure'
        order by dbo_infoseek_source.fulltitle asc");


    if( @mysqli_num_rows( $pull_images ) > 0 ) {
        echo '<table>';
        $count = 0;
        while( $row = mysqli_fetch_array( $pull_images ) ) {
            if( $count == 0 ) {
                echo "<tr><td>";
            } else {
                echo "<td>";
            }
            echo '<img src="' . $row['dbo_infoseek_source_additionals.url'] . '" alt="' . $row['dbo_infoseek_source.fulltitle'] . '" />';
            if( $count == 3 ) {
                echo '</td></tr>';
                $count = 0;
            } else {
                echo '<td>';
                $count++;
            }
        }
        $cells_left = 4 - $count;
        if( $cells_left > 0 ) {
            $i = 0;
            while( $i <= $cells_left ) {
                echo '<td></td>';
                $i++;
            }
            echo '</tr>';
        }
        echo '</table>';
    } else {
        echo "No images in the database.";
    }
?>

提前致谢

0 个答案:

没有答案