我想将下一行放在第一行的底部。我该怎么做?我使用PHP和jQuery制作表格。问题是当我创建多于1行时,结果在同一行中。关于我的问题有人可以帮我吗?数据来自我的数据库表。
//PHPCODE.PHP
else if(isset($_POST['btnView'])){
$selectData = $conn->query("SELECT * from tbl_wedding");
echo "<table align='center' border='1'>
<th>Groom FirstName</th>
<th>Groom MiddleName</th>
<th>Groom LastName</th>
<th>Groom DateOfBirth</th>
<th>Groom Address</th>
<th>Bride FirstName</th>
<th>Bride MiddleName</th>
<th>Bride LastName</th>
<th>Bride DateOfBirth</th>
<th>Bride Address</th>
<th>Reservation Date</th>
<th>Select Time</th>
<tr>";
while($row = $selectData->fetch_assoc()){
echo "<td>" . $row['GroomFirstName'] . "</td>" . "<td>" . $row['GroomMiddleName'] . "</td>" . "<td>" . $row['GroomLastName'] . "</td>" . "<td>" . $row['GroomDOB'] . "</td>" . "<td>" . $row['GroomAddress'] . "</td>" . "<td>" . $row['BrideFirstName'] . "</td>" . "<td>" . $row['BrideMiddleName'] . "</td>" . "<td>" . $row['BrideLastName'] . "</td>" . "<td>" . $row['BrideDOB'] . "</td>" . "<td>" . $row['BrideAddress'] . "</td>" . "<td>" . $row['ReservationDate'] . "</td>" . "<td>" . $row['SelectTime'] . "</td>";
}
echo "</tr></table>";
}
//JSCODE.JS
while($row = $selectData->fetch_assoc()){
echo "<td>" . $row['FirstName'] . "</td>" . "<td>" . $row['MiddleName'] . "</td>" . "<td>" . $row['LastName'] . "</td> " . "<td>" . $row['DateOfBirth'] . "</td>" . "<td>" . $row['Address'] . "</td>" . "<td>" . $row['NameOfFather'] . "</td>" . "<td>" . $row['NameOfMother'] . "</td>" . "<td>" . $row['ReservationDate'] . "</td>" . "<td>" . $row['BapSelectTime'] . "</td>";
}
echo "</tr></table>";
答案 0 :(得分:1)
您必须用<th>
围住<td>
和<tr>
。 <tr>
表示行。因此,每个数据必须在一行内倾斜。不是吗?
else if(isset($_POST['btnView'])){
$selectData = $conn->query("SELECT * from tbl_wedding");
echo "<table align='center' border='1'>
<tr>
<th>Groom FirstName</th>
<th>Groom MiddleName</th>
<th>Groom LastName</th>
<th>Groom DateOfBirth</th>
<th>Groom Address</th>
<th>Bride FirstName</th>
<th>Bride MiddleName</th>
<th>Bride LastName</th>
<th>Bride DateOfBirth</th>
<th>Bride Address</th>
<th>Reservation Date</th>
<th>Select Time</th>
</tr>";
while($row = $selectData->fetch_assoc()){
echo "<tr><td>" . $row['GroomFirstName'] . "</td>" . "<td>" . $row['GroomMiddleName'] . "</td>" . "<td>" . $row['GroomLastName'] . "</td>" . "<td>" . $row['GroomDOB'] . "</td>" . "<td>" . $row['GroomAddress'] . "</td>" . "<td>" . $row['BrideFirstName'] . "</td>" . "<td>" . $row['BrideMiddleName'] . "</td>" . "<td>" . $row['BrideLastName'] . "</td>" . "<td>" . $row['BrideDOB'] . "</td>" . "<td>" . $row['BrideAddress'] . "</td>" . "<td>" . $row['ReservationDate'] . "</td>" . "<td>" . $row['SelectTime'] . "</td></tr>";
}
echo "</table>";
}
//JSCODE.JS
while($row = $selectData->fetch_assoc()){
echo "<tr><td>" . $row['FirstName'] . "</td>" . "<td>" . $row['MiddleName'] . "</td>" . "<td>" . $row['LastName'] . "</td> " . "<td>" . $row['DateOfBirth'] . "</td>" . "<td>" . $row['Address'] . "</td>" . "<td>" . $row['NameOfFather'] . "</td>" . "<td>" . $row['NameOfMother'] . "</td>" . "<td>" . $row['ReservationDate'] . "</td>" . "<td>" . $row['BapSelectTime'] . "</td></tr>";
}
echo "</table>";