简体   繁体   English

while循环中的图像

[英]image in while loops

I'm trying to create echo image in while loops with table, but I'm getting the error . 我正在尝试使用表格在while循环中创建echo图像,但我收到了错误。 please see part of the code 请参阅部分代码

                $image = $rows['image']; 
                $sql = "SELECT * FROM boxes ";
                $result = $db->query($sql);
                if ($result->num_rows > 0) {
                    while ($row = $result->fetch_assoc()) {
                        if ($row['status'] == 1)
                            $visible = "visible";
                        else
                            $visible = "hidden";

                        if ($row['side'] == 1)
                            $side = "right";
                        else if ($row['side'] == 2)
                            $side = "left";
                        else $side = "not set yet";

                        echo "



        <tr>
          <td width=\"15%\" rowspan=\"3\"><img src="data:image' image \. ($row['image']).'" />';</td>
          <td width=\"85%\" colspan=\"5\">".$row['title_boxe'] . "</td>
        </tr>
        <tr>
          <td colspan=\"5\">desc</td>
        </tr>
        <tr>

          <td>Visible</td>

          <td>sss</td>
          <td><form method='post'><input type='hidden' name='id' value='" . $row['id_boxe'] . "'/>
              <input type='submit' name='update' value='Update' class=\"btn btn-primary\"/></form></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td colspan=\"6\">hr</td>
        </tr>
         <tr>
          <td colspan=\"6\">&nbsp;</td>
        </tr>


                     ";
                    }
                }
                ?>
      </tbody>
    </table>

what wrong with this line of code inside of php that i can figure out how to solve this... php中的这行代码有什么问题,我可以弄清楚如何解决这个问题...

<td width=\"15%\" rowspan=\"3\"><img src="data:image' image \. ($row['image']).'" />';</td>

many thanks for your help. 非常感谢您的帮助。

Seems that you echo is wrong ( and to me is not clear what you are doing with <src='data:image image .. if you need a \\ but this interfer with quote escape it using \\ 似乎你的回声是错的(并且我不清楚你正在做什么<src='data:image image ..如果你需要一个\\但这个干扰引用逃脱它使用\\

      echo "
    <tr>
      <td width='15%' rowspan='3'><img src='../image/box-manage/" . $row['image'] ."' />;</td>
      <td width='85%' colspan='5'>". $row['title_boxe'] . "</td>
    </tr>
    <tr>
      <td colspan='5'>desc</td>
    </tr>
    <tr>

      <td>Visible</td>

      <td>sss</td>
      <td><form method='post'><input type='hidden' name='id' value='" . $row['id_boxe'] . "'/>
          <input type='submit' name='update' value='Update' class='btn btn-primary'/></form></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td colspan='6'>hr</td>
    </tr>
     <tr>
      <td colspan='6'>&nbsp;</td>
    </tr>";

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

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