我有一张表,其中包含城市,人员,employment_status。我想用PHP的这个值填充我的html表格,第一个td
将包含一个城市,下一个将包含该城市的总人数,第三个td
将包含雇用的总人数。通常我使用while填充我的表,但是这个我不知道如何去查询mysqli,如果while也能工作,检查一个解决方案但是找不到,一直呆在这里好几天。使用数据库值填充HTML表格
<table class="table table-striped table-advance table-hover search-table" >
<tbody>
<thead>
<tr>
<th><i class="icon_profile"></i> city</th>
<th><i class="icon_pin_alt"></i> Total number of people</th>
<th><i class="icon_pin_alt"></i> no of pepople employed</th>
</tr>
</thead>
<?php
$sql = "SELECT COUNT(DISTINCT city) FROM user";
$q=$conn->query($sql);
while ($row = mysqli_fetch_array($q)) {
我坚持在这里,它的查询部分,没有在数据库中创建为我提供此行的值
它不工作就像我的男人,你必须告诉我们的代码,所以我们可以看到你到目前为止做了什么......向我们展示代码,然后我们会从那里拿走它。 –
有许多教程可用于此。这是一个http://www.c-sharpcorner.com/UploadFile/d9da8a/display-data-with-html-table-in-php/ – mahethekiller
就像你以前一样,在另一个问题,你问? http://stackoverflow.com/questions/40031821/how-to-search-an-html-table-that-collects-data-from-mysqli – Qirel