简体   繁体   中英

display the same image in a loop while retrieving data from mysql table

I'm looking for a solution to the following.

I have certain data stored in a mysql table. As for now I am able to retrieve the data and display it on a page. But now I would like to add a small png to one specific part of the data. One variable is a time period, like '25-28 of March', this continually changes. But I would like to add a calendar icon in front of this. How can I best proceed. I've been looking at this for hours now.

This is my php code to display the data on the page (write_to_site.php):

if ($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
        echo "<h3> " . $row["conferentie"] . "</h3><p>" . HERE THE ICON $row["datums"] . "</p><p>" . $row["locatie"] . "</p><hr>";
    }

I use php include write_to_site.php on the page where I want this displayed.

It should look something like this (this is only html): example

So the icon should always be the same, so there is no need to store it in de database.

Thanks in advance!

change this "</h3><p>" . HERE THE ICON "</h3><p>" . HERE THE ICON to "</h3><p><img src=\\"myIcon.png\\" />" .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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