从MYSQL服务器检索数据时,似乎限制了输出结果。请参阅以下附件
代码:
<style>
tr,td {
border:1px red solid;
}
</style>
<?php
include('./connect.php');
if (!$connect) {
die('Could not connect: ' . mysql_error());
}
$db_selected = mysqli_select_db($connect, db_name);
if (!$db_selected) {
die('Can\'t use ' . db_name . ': ' . mysql_error());
}
//execute the SQL query and return records
$result = mysqli_query($connect, "SELECT * From jobs ORDER BY id DESC LIMIT 1");
echo "<table style='border:1px solid red'>";
while($row = mysqli_fetch_array($result)) {
echo '<tr><td>Reference Number:</td><td>'; echo $row['ID'];'</td></tr>';
echo '<tr><td>First Name:</td><td>'; echo $row['FirstName'];'</td></tr>';
echo '<tr><td>LastName:</td><td>'; echo $row['LastName'];'</td></tr>';
echo '<tr><td>Phone Numbner:</td><td>'; echo $row['Phone'];'</td></tr>';
echo '<tr><td>Email:</td><td>'; echo $row['Email'];'</td></tr>';
echo '<tr><td>Items:</td><td>'; echo $row['Items'];'</td></tr>';
echo '<tr><td>Fault:</td><td style="width:100%">'; echo $row['Issue'];'</td></tr>';
}
echo "</table>";
//close connection
mysqli_close($connect);
?>
输出结果:
Connected successfully
Reference Number: 100000
First Name: Jane
LastName: Doe
Phone Numbner: 3372555897
Email: janedoe@unknown.com
Items: laptop
Fault: Client states her laptop will no longer power on. However, p
正如您在故障标题下看到的那样,显示的内容应该更多。
答案 0 :(得分:2)
您的输出有多处错误。
echo '<tr><td>Reference Number:</td><td>'; echo $row['ID'];'</td></tr>';
^^^^^^
Missing echo
这会发生在每一行上,并会导致布局错误,这可能会隐藏您的内容。
答案 1 :(得分:0)
我已经找到了原因并且在我发布我的回复后才点击了它。我在mysql表中有64vchar限制。将其更改为1024,现在工作正常。