我有表名为ipcam (camera id,camera name,camera model,IP address, Url, Port)
. 我能够成功地从 MySQL 数据库中检索数据。现在我打算做的是在表的末尾添加一个额外的字段Delete
- 这是超链接并通过将 id 发送到页面来删除该行deletecam.php
是代码:
<?php
$result = mysql_query("SELECT * from ipcam WHERE user_id = {$user_id}");
echo"<table border=5 colspan=6> <tr><th>IP CAMERA ID </th><th>IP CAMERA NAME </th><th>CAMERA MODEL </th> <th>IP ADDRESS </th> <th>URL </th> <th>PORT </th><th>DELETE </th></tr>";
while($row = mysql_fetch_array($result)){
echo "<tr>
<td>" . $row['id'] . "</td>
<td>" . $row['name'] . "</td>
<td>" . $row['model'] . "</td>
<td>" . $row['ipaddress'] . "</td>
<td>" . $row['url'] . "</td>
<td>" . $row['port'] . "</td>
<td> echo"<html><h3>"; <a href="/deletecam.php?id= <?php echo urlencode($row['id']); ?> "> Delete </a> echo"</h3></html>"; </td></tr>";
}
echo "</table>";
?>
但是,当我运行此代码时遇到奇怪的问题,错误是:
Parse error: syntax error, unexpected '>' in C:\xampp\htdocs\IPCAM\cameralist.php on line 176
当我尝试在代码中包含超链接时,删除错误。我是在语法上做错了什么,还是不可能做这样的事情。