首页 > 解决方案 > 使 PHP 脚本可编辑并从 SQL 表中提取数据

问题描述

我已经在 HTML 中创建了表格并使用在线工具将其转换为 PHP。以下是表格的部分编码和图像。现在我想让文本框可编辑并显示 sql 表中的数据。我怎样才能做到这一点?

表格图像

 print "    <td class=\"tg-7btt\">U</td>\n";
 print "    <td class=\"tg-fymr\"><W/td>\n";
 print "    <td class=\"tg-fymr\">X</td>\n";
 print "    <td class=\"tg-fymr\">Y</td>\n";
 print "    <td class=\"tg-fymr\">Z</td>\n";
 print "  </tr>\n";
 print "  <tr>\n";
 print "    <td class=\"tg-fymr\">Planned Execution Metrics</td>\n";
 print "    <td class=\"tg-c3ow\" colspan=\"5\"></td>\n";
 print "  </tr>\n";
 print "  <tr>\n";
 print "    <td class=\"tg-0pky\">Total planned Test Cases</td>\n";
 print "    <td class=\"tg-c3ow\"></td>\n";
 print "    <td class=\"tg-0pky\"></td>\n";
 print "    <td class=\"tg-0pky\"></td>\n";
 print "    <td class=\"tg-0pky\"></td>\n";
 print "    <td class=\"tg-0pky\"></td>\n";
 print "  </tr>\n";

标签: phphtml

解决方案


为什么需要文本框,您可以直接从下面的代码中完成

<div class="tables">
<table class="table"> <thead> <tr> <th>Id</th> <th>Message</th> <th>Date</th> <th>Exipry date</th>  <th> Actions </th> <th> &nbsp </th> </tr> </thead> 
<tbody> 
<?php
 $sql="select * from notice";
 $result=mysql_query($sql);
while($row=mysql_fetch_array($result))
{
echo "<tr class='active'> 
        <td>".$row[0]."</td> 
        <td>".$row[1]."</td> 
        <td>".$row[2]."</td> 
        <td>".$row[3]."</td>
        </tr>";
    }
?>

推荐阅读