【发布时间】:2014-08-15 21:55:10
【问题描述】:
我正在尝试在表格的单个字段中显示姓名和年龄,并且我希望将数据显示在   的位置。我尝试了下面的代码,但它不起作用。
代码:
<?php
$con=mysqli_connect("localhost","root","","dva");
// Check connection
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM apform");
while($row = mysqli_fetch_array($result)) {
echo "My Mood: ";
echo $row['mood'];
echo "<br>";
}
?>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Doctor</th>
<th>Telephone</th>
<th>Mobile</th>
<th>Meeting Time</th>
<th>Fee</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<tr>
<td data-title="Name"><span> <?php echo $row['name']; ?> </span></td>
<td data-title="Relationship"><span> </span></td>
<td data-title="Address"><span> </span></td>
<td data-title="Telephone"><span> </span></td>
<td data-title="Mobile"><span> </span></td>
<td data-title="Contact at night"><span> </span></td>
<td data-title="Next of kin"><span> </span></td>
<td data-title="Delete"><span> </span></td>
</tr>
【问题讨论】:
-
在
while循环中写入tbody代码 -
你的代码是正确的,什么不工作?
-
请学习PHP基础知识。
标签: javascript php jquery html mysql