duancong7573 2019-03-20 19:04
浏览 59

如何在数组中显示图像

I have an issue on displaying an image on a simple array Here is my problem :

<?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}*/

So the code is correct when I manually type the link of an image instead of "$test" Also the SQL query is correct if I test it on some values. I personnally think that the "$l" or "$c" are not correctly read by php Or maybe that the "$test" variable is correct but isn't read by the src attribute. Could you help please ? Thanks

  • 写回答

1条回答 默认 最新

  • dongzouh51192 2019-03-20 20:05
    关注

    Problem solved.. Even if I checked bad mistakes it was "./connect.php" ... Thank you anyway

    评论

报告相同问题?

悬赏问题

  • ¥15 远程桌面文档内容复制粘贴,格式会变化
  • ¥15 关于#java#的问题:找一份能快速看完mooc视频的代码
  • ¥15 这种微信登录授权 谁可以做啊
  • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
  • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”
  • ¥15 网络设备配置与管理这个该怎么弄
  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题