2016-11-05 65 views
-5

这是我的代码未定义指数:图像3

<form action = "#" method = "POST"> 
     <?php 
      $am=$_GET["am"]; 
      $res=mysql_query("select * from blotterreport where subject like('$am%')"); 
      echo "<table border='1'>"; 
      while ($row=mysql_fetch_array($res)) { 
       echo "<tr>"; 
       echo "<td>"; echo $row["entrynumber"]; echo"</td>"; 
       echo "<td>"; echo $row["natureofcase"]; echo"</td>"; 
       echo "<td>"; echo $row["month"]; echo"</td>"; 
       echo "<td>"; echo $row["subject"]; echo"</td>"; 
       echo "<td>"; echo $row["<image src=view.png onclick= width=100% height=5%/>"]; echo"</td>"; /**this is the undefined index**/ 
       echo "<td>"; echo $row["<image src=edit.png onclick= width=100% height=5%/>"]; echo"</td>"; /**this is the undefined index**/ 
       echo "</tr>"; 
      } 

     ?> 
    </form> 
+0

只要看看那一行,很明显它为什么不起作用。并请妥善格式化您的代码 –

+0

为什么要将整个图像标记添加为$ row索引? –

回答

0

你可能在寻找这样的:

<form action = "#" method = "POST"> 
     <?php 
      $am=$_GET["am"]; 
      $res=mysql_query("select * from blotterreport where subject like('$am%')"); 
      echo "<table border='1'>"; 
      while ($row=mysql_fetch_array($res)) { 
       echo "<tr>"; 
       echo "<td>"; echo $row["entrynumber"]; echo"</td>"; 
       echo "<td>"; echo $row["natureofcase"]; echo"</td>"; 
       echo "<td>"; echo $row["month"]; echo"</td>"; 
       echo "<td>"; echo $row["subject"]; echo"</td>"; 
       echo "<td>"; echo "<img src=view.png onclick= width=100% height=5%/>"; echo"</td>"; /**this is the undefined index**/ 
       echo "<td>"; echo "<img src=edit.png onclick= width=100% height=5%/>"; echo"</td>"; /**this is the undefined index**/ 
       echo "</tr>"; 
      } 

     ?> 
    </form> 

行的指标涉及到你的数据库表中的列名。我怀疑你有一个名为"<image src=edit.png onclick= width=100% height=5%/>"的数据库列。

你不需要那么多'回声'命令。