我已经完成了所有教程,但并不满意,甚至将事情混为一谈,看看它是否可以工作,但北向工作。
<?
require( '../connect_db.php' ) ;
echo '<h1>List All Customers</h1> ' ;
$query = "SELECT * FROM CUSTOMER";
$result= mysqli_num_rows($dbc,$query)
if(mysqli_num_rows($result) > 0){
$clientid=mysql_result($result,"clientid");
$inital=mysql_result($result,"inital");
$firstname=mysql_result($result,"firstname");
$lastname=mysql_result($result,"lastname");
$mobile=mysql_result($result,"mobile");
$landline=mysql_result($result,"landline");
$email=mysql_result($result,"email");
$address=mysql_result($result,"address");
$postcode=mysql_result($result,"postcode");
echo '<table class="table table-hover">
<caption>List All Customers from Customer Table</caption>
<thead>
<tr>
<th>id</th>
<th>Inital</th>
<th>First Name</th>
<th>Last Name</th>
<th>Mobile</th>
<th>Landline</th>
<th>Email</th>
<th>Address</th>
<th>Post Code</th>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo $clientid; ?></td>
<td><?php echo $inital; ?></td>
<td><?php echo $firstname; ?></td>
<td><?php echo $lastname; ?></td>
<td><?php echo $mobile; ?></td>
<td><?php echo $landline; ?></td>
<td><?php echo $email; ?></td>
<td><?php echo $address; ?></td>
<td><?php echo $postcode; ?></td>
</tr>
</tbody>
</table>'
} else {'<p>There are currently no customers on the system.</p>';}
?>
虽然它不起作用,但我需要一种简单的方法来显示表记录并设置它们的样式,以便它们易于阅读。我只需要知道要使用什么,因为我参考了仅带回第一个 id 的手册或仅显示数据库表的“显示表”但是当我尝试显示记录时它不起作用所以我知道不可能那么容易!
请问你能帮忙吗?