我不断收到echo语句的错误。报价是错误的吗?我应该在$ row语句周围添加引号
<?php
while($row = mysql_fetch_array($search))
{
echo "<tr>"//the line below
'<td>' . $row['DepartmentOwner'] . '</td>';
'<td>' . $row['CurrentAssignee'] . '</td>';
'<td>' . $row['Location'] . '</td>';
'<td>' . $row['LaptopSerialNumber'] . '</td>';
'<td>' . $row['SupportedOS'] . '</td>';
'<td>' . $row['DeviceName'] . '</td>';
'<td>' . $row['IMEISerialNumber'] . '</td>';
'<td>' . $row['UUID'] . '</td>';
'<td>' . $row['ReturnDate']'</td>';
"</tr>";
}
echo "</table>"; ?>
答案 0 :(得分:2)
在这一行
'<td>' . $row['ReturnDate']'</td>'
应该是
'<td>' . $row['ReturnDate'] . '</td>'
您缺少字符串连接符.
while($row = mysql_fetch_array($search)){
echo "<tr>";
echo '<td>' . $row['DepartmentOwner'] . '</td>';
echo '<td>' . $row['CurrentAssignee'] . '</td>';
echo '<td>' . $row['Location'] . '</td>';
echo '<td>' . $row['LaptopSerialNumber'] . '</td>';
echo '<td>' . $row['SupportedOS'] . '</td>';
echo '<td>' . $row['DeviceName'] . '</td>';
echo '<td>' . $row['IMEISerialNumber'] . '</td>';
echo '<td>' . $row['UUID'] . '</td>';
echo '<td>' . $row['ReturnDate'] . '</td>';
echo "</tr>";
}
echo "</table>"; ?>
答案 1 :(得分:0)
如果你关闭你的回声,你需要再次写回声!
<?php
while($row = mysql_fetch_array($search))
{
echo "<tr>";//the line below
echo '<td>' . $row['DepartmentOwner'] . '</td>';
echo '<td>' . $row['CurrentAssignee'] . '</td>';
echo '<td>' . $row['Location'] . '</td>';
echo '<td>' . $row['LaptopSerialNumber'] . '</td>';
echo '<td>' . $row['SupportedOS'] . '</td>';
echo '<td>' . $row['DeviceName'] . '</td>';
echo '<td>' . $row['IMEISerialNumber'] . '</td>';
echo '<td>' . $row['UUID'] . '</td>';
echo '<td>' . $row['ReturnDate'].'</td>';
echo "</tr>";
}
echo "</table>"; ?>
答案 2 :(得分:0)
你错误地将传递给echo
的字符串连接起来,你可以使用PHP的alternate syntax来避免这种情况(并使代码更加清晰)。
<?php while($row = mysql_fetch_array($search)): ?>
<tr>
<td><?php echo $row['DepartmentOwner']; ?></td>
<td><?php echo $row['CurrentAssignee']; ?></td>
<td><?php echo $row['Location']; ?></td>
...
...
...
</tr>
<?php endwhile; ?>
安东尼。