简体   繁体   English

图片来自数据库 phpmyadmin

[英]image from database phpmyadmin

I have a little problem I try to display a url image that there is in my phpmyadmin database, but nothing is displayed.我有一个小问题,我尝试显示 phpmyadmin 数据库中的 url 图像,但没有显示任何内容。 I am trying to display an image from my database.我正在尝试显示我的数据库中的图像。 I put you my code and my line of the database.我给你我的代码和我的数据库行。 Thank you in advance for your help !预先感谢您的帮助 !在此处输入图像描述

see if I made a mistake in the code, or if I used the wrong path看看我是否在代码中犯了错误,或者我是否使用了错误的路径

the URL of my image is called "img_l" in my database and it is in a category called "liste"我的图像的 URL 在我的数据库中被称为“img_l”,它属于一个名为“liste”的类别

Voici mon code:语音代码:

<?php
    $bdd = new PDO('mysql:host=localhost;dbname=animebd;chaset=utf8','root','');
    $req = $bdd->query('SELECT img_l,nomL FROM liste');
    while($donnees = $req->fetch()){
        echo('<img style="width:50px;height:50px;border-radius;:500px;" img_l = "' . $donnees['img_l'] . '"/><br/>');
    }
?>

In image tag, you don't have src attribute.在图像标签中,您没有 src 属性。 You must add it and concatenate your data from db with images directory.您必须添加它并将 db 中的数据与 images 目录连接起来。

$path = './public/images/' . $donnees['img_l'];

of course my answer is valid only if $donnees['img_l'] is the filename with extension (mycar.jpg)当然,我的回答只有在$donnees['img_l']是带扩展名的文件名 (mycar.jpg) 时才有效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM