【发布时间】:2017-11-08 04:35:23
【问题描述】:
嗨,我在 index.php 上收到了这条消息
注意:使用未定义的常量 id - 在第 70 行的 C:\xampp\htdocs\practice\index.php 中假定为“id”
注意:使用未定义的常量部门 - 在第 71 行的 C:\xampp\htdocs\practice\index.php 中假定为“部门”
注意:使用未定义的常量保管人 - 在第 72 行的 C:\xampp\htdocs\practice\index.php 中假定为“保管人”
注意:使用未定义的常量位置 - 在第 73 行的 C:\xampp\htdocs\practice\index.php 中假定为“位置”
注意:使用未定义的常量品牌 - 在第 74 行的 C:\xampp\htdocs\practice\index.php 中假定为“品牌”
注意:使用未定义的常量模型 - 第 75 行 C:\xampp\htdocs\practice\index.php 中假定为“模型”
注意:使用未定义的常量 hardwaresn - 在第 76 行的 C:\xampp\htdocs\practice\index.php 中假定为“hardwaresn”
注意:使用未定义的常量硬盘 - 在第 77 行的 C:\xampp\htdocs\practice\index.php 中假定为“硬盘”
注意:使用未定义的常量处理器 - 在第 78 行的 C:\xampp\htdocs\practice\index.php 中假定为“处理器”
注意:使用未定义的常量 ram - 在第 79 行的 C:\xampp\htdocs\practice\index.php 中假定为“ram”
注意:使用未定义的常量监视器 - 在第 80 行的 C:\xampp\htdocs\practice\index.php 中假定为“监视器”
注意:使用未定义的常量 actualos - 在第 81 行的 C:\xampp\htdocs\practice\index.php 中假定为“actualos”
注意:使用未定义的常量 msoffice - 在第 82 行的 C:\xampp\htdocs\practice\index.php 中假定为“msoffice”
注意:使用未定义的常量供应商 - 在第 83 行的 C:\xampp\htdocs\practice\index.php 中假定为“供应商”
注意:使用未定义的常量 invoicenumber - 在第 84 行的 C:\xampp\htdocs\practice\index.php 中假定为“invoicenumber”
注意:使用未定义的常量 purchaseate - 在第 85 行的 C:\xampp\htdocs\practice\index.php 中假定为“purchasedate”
注意:使用未定义的持续保修 - 在第 86 行的 C:\xampp\htdocs\practice\index.php 中假定“保修”
Id Deparment Custodian Location Brand Model Hardware SN Case/Monitor HardDisk Processor Ram Monitor Actual OS MS Office Supplier Invoice No. Purchase Date Warranty Line to Edit Line to Delete
1 Motor Ibrahim Abu Lebda 1st Floor Lenovo MTM 10A9-003CAX PC08KULS/ CNC137R2N1 1TB Intel Core i7 8GB 20'' LED HP Win 7 Pro 2013 0000-00-00 Out Of Warranty Edit Delete
Add New Record
这是我的代码,请帮助我识别未声明的内容。
<html>
<head>
<title>IT Equipment Inventory System</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<h1><center>IT Equipment Inventory System</center></h1>
<?php
echo "<marquee>" . "Today is " . date("m/d/Y") . "</marquee>";
echo "<marquee>" . "Today is " . date("l") . "</marquee>";
?>
<?php
// connect to the database
include 'db_connection.php';
$conn = OpenCon();
//echo "Connected Successfully";
// get the records from the database
$result = mysqli_query($conn, "SELECT * FROM tb1");
CloseCon($conn);
// display records in a table
echo "<p><b>View All</b> | <a href='view-paginated.php?page=1'>View Paginated</a></p>";
echo "<table border='1' cellpadding='10'>";
// set table headers
echo "<tr>
<th>Id</th>
<th>Deparment</th>
<th>Custodian</th>
<th>Location</th>
<th>Brand</th>
<th>Model</th>
<th>Hardware SN Case/Monitor</th>
<th>HardDisk</th>
<th>Processor</th>
<th>Ram</th>
<th>Monitor</th>
<th>Actual OS</th>
<th>MS Office</th>
<th>Supplier</th>
<th>Invoice No.</th>
<th>Purchase Date</th>
<th>Warranty</th>
<th>Line to Edit</th>
<th>Line to Delete</th>
</tr>";
while($row = mysqli_fetch_array( $result )) {
// set up a row for each record
echo '<tr>';
echo '<td>' . $row[id] . '</td>';
echo '<td>' . $row[department] . '</td>';
echo '<td>' . $row[custodian] . '</td>';
echo '<td>' . $row[location] . '</td>';
echo '<td>' . $row[brand] . '</td>';
echo '<td>' . $row[model] . '</td>';
echo '<td>' . $row[hardwaresn] . '</td>';
echo '<td>' . $row[hardisk] . '</td>';
echo '<td>' . $row[processor] . '</td>';
echo '<td>' . $row[ram] . '</td>';
echo '<td>' . $row[monitor] . '</td>';
echo '<td>' . $row[actualos] . '</td>';
echo '<td>' . $row[msoffice] . '</td>';
echo '<td>' . $row[supplier] . '</td>';
echo '<td>' . $row[invoicenumber] . '</td>';
echo '<td>' . $row[purchasedate] . '</td>';
echo '<td>' . $row[warranty] . '</td>';
echo '<td><a href="edit.php?id=' . $row['id'] . '">Edit</a></td>';
echo '<td><a href="delete.php?id=' . $row['id'] . '">Delete</a></td>';
echo '</tr>';
}
echo "</table>";
?>
<a href="New.php">Add New Record</a>
</body>
</html>
【问题讨论】:
-
您需要在变量
$row['id']、$row['department']等周围添加引号。 -
感谢 S.I 和 Alive 现在死得好好的
-
@HeroPinedaBaculinao 很高兴为您提供帮助。 :):)
标签: php