如何在数组中显示图像

问题描述 投票:-1回答:1

我有一个关于在简单数组上显示图像的问题这是我的问题:

<?php
session_start();
include("/connect.php");
?>
<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="JeuCSS.css"/>
    </head>
    <body>
    <h1><center>SUDOKU</center></h1>


<?php
$taille=9;
print "<center><table>";
for ($l = 1; $l <= $taille; $l++ ) {
    print "<tr>";
    for ($c = 1; $c <= $taille; $c++){
        $parse_select = oci_parse($dbConn, 
                        "SELECT I.lien_image
                        FROM Image I, Cases C
                        WHERE C.X_case = $l
                        AND C.Y_case = $c
                        AND C.num_grille = 31
                        AND C.num_image=I.num_image");
        if (!$parse_select) {
            $e = oci_error($dbConn);
            echo htmlentities($e['message']);
        }
        // Exécution de la logique de la requête
        $req = oci_execute($parse_select);
        if (!$req) {
            $e = oci_error($parse_select);
            echo(htmlentities($e['message']));
        }
        // Récupération de l'image
        $img_link = oci_fetch_array($parse_select, OCI_ASSOC+OCI_RETURN_NULLS);
        $test=current($img_link);
        echo "<td id = \"l".$l."c".$c."\" > <img src='".$test."' width='98px' height='85px' /></td>";
    }
    print "</tr>";
}
print "</table></center>";
?>


<p id="niveau">test</p>
    </body>
</html>

CSS:

body{font-family:arial;background-color:white;color:black} 
table {border-collapse:collapse;border:medium solid;text-align:center} 
td{height:85px;width:98px;border: medium solid}
/*#c1l1 {background-color:red}*/

因此,当我手动键入图像的链接而不是“$ test”时,代码是正确的。如果我在某些值上测试它,SQL查询也是正确的。我个人认为php没有正确读取“$ l”或“$ c”或者“$ test”变量是正确的但是src属性没有读取。你能帮帮忙吗?谢谢

php
1个回答
-1
投票

问题解决了..即使我检查了错误,也是“./connect.php”......无论如何,谢谢你

© www.soinside.com 2019 - 2024. All rights reserved.