Home>

An example in which the image is not displayed through the database. What could be the problem? I would be grateful for the answer

<
img src= "<
? php echo "{$ result ['img']}";? >
"≫

">

Сергей2021-05-23 17:14:56

What are these quotes and brackets when withdrawing? VAR_DUMP ($ Result); lay out here

InDevX2021-05-23 17:38:51

The image of the IMG tag is placed in quotation

Сергей2021-05-23 17:42:34

$ result ['img'] that contains show

InDevX2021-05-23 17:43:26

interactive-examples.mdn.mozilla.net/media/cc0-images/... -this is contained in the line I tried to make a tag in the database itself, it is not even output, works through HTML, working database, for it is one of the columns

Сергей2021-05-23 17:45:35
  • Answer # 1

    If the file is stored on your server and in the database, the link is stored without a slash ( / ) at the beginning, then it can be generated incorrectly, like mysite.comimage.jpg. .

    i.e. In places where such a mono links are displayed in the template:

    <
    img src= "/<
    ?= $ result ['img']; ? ≫
    "≫
    

    If the object comes into the template, then you can also:

    <
    img src= "/<
    ?= $ result->
    img; ? ≫
    "≫
    

    ; At the end is not obligatory.

    Here this link, I copy it from the database, everything works directly: interactive-examples.mdn.mozilla.net/media/cc0-images/...

    Сергей2021-05-23 17:21:58

    And as soon as I put this: ">stops working

    Сергей2021-05-23 17:24:04

    And $ result in what form comes?

    Starik2021-05-23 17:24:46

    And why there are curly brackets?

    Starik2021-05-23 17:25:13

    Simplified code in response.

    Starik2021-05-23 17:27:21
  • Answer # 2

    If the file is stored on your server and in the database, the link is stored without a slash ( / ) at the beginning, then it can be generated incorrectly, like mysite.comimage.jpg. .

    i.e. In places where such a mono links are displayed in the template:

    <
    img src= "/<
    ?= $ result ['img']; ? ≫
    "≫
    

    If the object comes into the template, then you can also:

    <
    img src= "/<
    ?= $ result->
    img; ? ≫
    "≫
    

    ; At the end is not obligatory.

    Here this link, I copy it from the database, everything works directly: interactive-examples.mdn.mozilla.net/media/cc0-images/...

    Сергей2021-05-23 17:21:58

    And as soon as I put this: ">stops working

    Сергей2021-05-23 17:24:04

    And $ result in what form comes?

    Starik2021-05-23 17:24:46

    And why there are curly brackets?

    Starik2021-05-23 17:25:13

    Simplified code in response.

    Starik2021-05-23 17:27:21