从mysql表中检索数据时,在循环中显示相同的图像

时间:2021-12-15 16:28:53

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.

我有一些数据存储在mysql表中。至于现在,我能够检索数据并将其显示在页面上。但是现在我想在数据的一个特定部分添加一个小png。一个变量是一个时间段,如“3月25日 - 28日”,这种情况会不断变化。但我想在此前面添加一个日历图标。我怎样才能最好地进行。我一直在看这几个小时。

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

这是我在页面上显示数据的php代码(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.

我在我想要显示的页面上使用php include write_to_site.php。

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

它应该看起来像这样(这只是html):例子

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

因此图标应始终相同,因此无需将其存储在de数据库中。

Thanks in advance!

提前致谢!

1 个解决方案

#1


0  

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

改变这个“

”。这里的图标是“

从mysql表中检索数据时,在循环中显示相同的图像”。

#1


0  

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

改变这个“

”。这里的图标是“

从mysql表中检索数据时,在循环中显示相同的图像”。