大家好,我是新手,我正在尝试制作一个简单的动态 HTML。我写了下面的代码,但似乎不起作用。有人能帮我吗。因为我得到的只是以下行
$row[name]"); echo (""); echo (""); echo (""); echo (""); } ?>
<小时/>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table>
<tr>
<td align="center">EDIT DATA</td>
</tr>
<tr>
<td>
<table border="1">
<?
mysql_connect("localhost","user","pass");
mysql_select_db("Computers");
$order = "SELECT * FROM vnc";
$result = mysql_query($order);
while ($row=mysql_fetch_array($result)){
echo ("<td>$row[name]</td>");
echo ("<td>$row[department]</td>");
echo ("<td>$row[phone]</td>");
echo ("<td>$row[ip]</td>");
echo ("<td><a href="edit_form.php?id=$row[id]">Edit</a></td></tr>");
}
?>
</table>
</td>
</tr>
</table>
</body>
</html>
提前谢谢
最佳答案
这应该适合你
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table>
<tr>
<td align="center">EDIT DATA</td>
</tr>
<tr>
<td>
<table border="1">
<?php
mysql_connect("localhost","user","pass");
mysql_select_db("Computers");
$order = "SELECT * FROM vnc";
$result = mysql_query($order);
while ($row=mysql_fetch_array($result)){
echo "<td>" . $row[name] . "</td>
<td>" . $row[department] . "</td>
<td>" . $row[phone] . "</td>
<td>" . $row[ip] . "</td>
<td><a href="edit_form.php?id=" . $row[id] . ">Edit</a></td></tr>";
}
?>
</table>
</td>
</tr>
</table>
</body>
</html>
关于PHP、MySQL 结果中出现 HTML 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16550123/