php - 在引导模式中打开表

标签 php mysql

我的页面上有一个表格。我想在模型中打开一个表格,以便在单击 td 时显示特定记录。下面是我的代码,我的问题是当我使用此代码模型成功打开但我的页表布局无法正确显示时。

<table class="table table-bordered table-striped mb-none" id="datatable-default">
<?php 
$result=mysqli_query($con,"select * from class_review as a left join class_user_details as b on a.list_id = b.id group by list_id");
//$result=mysqli_query($con,"select * from class_review as a left join class_user_details as b on a.list_id = b.id left join class_users as c on a.user_id=c.id");
//echo "select * from class_review as a left join class_user_details as b on a.list_id = b.id left join class_users as c on a.user_id=c.id";
?>
<thead>
<tr>
<th>#</th>
<th>Shop Name</th>
<!--<th>User Name</th>-->
<th>Total Review </th>
<th>Average Rate</th>
<th>See All Review</th>
</tr>
</thead>
<tbody>
<?php $i=1;while($row=mysqli_fetch_array($result)) { ?>
<tr>
<td><?php echo $i; ?></td>
<td><?php echo $row['shop_name'] ; ?></td>
<?php $list_id=$row['list_id']; $query=mysqli_query($con,"SELECT count(*) from class_review where list_id=$list_id");
$fetch=mysqli_fetch_array($query); ?>
<td><?php echo $fetch[0] ; ?></td>
<td><?php echo $row['rate_point'] ; ?></td>
<td><a href="#" data-toggle="modal" data-target="#myModal1<?php echo $row['list_id'] ; ?>"><button type="button" class="btn btn-info">Reviews</button></td>
</tr>
<!--My Stuff start -->
<div id="myModal1<?php echo $row['list_id'] ; ?>" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title"></h4>
</div>
<div class="modal-body">
<table>
<thead>
<tr>
<th>#</th>
<th>User Name</th>
<th>Review </th>
<th>Average Rate</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td>dd</td>
<td>ddd</td>
<td>ee</td>
<td>dfd</td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button id="dialoge<?php echo $row['id'] ; ?>" class="btn btn-primary">Confirm</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>

<!--My Stuff end -->
<?php $i++; } ?>    
</tbody>
</table>

最佳答案

你的模态表没有响应,请制作这样的结构

 <div class="table-responsive">
     <table class="table table-bordered table-striped">

     //rest of code

    </table>

</div>

关于php - 在引导模式中打开表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43863253/

相关文章:

php - facebook API 有什么好的 totuiral 吗?是否有可能在我的网站上获取用户的好友列表?

php - 如何在不重新加载页面的情况下从数据库获取数据?

php - 如何在 Laravel 中获取 POST 的所有输入

mysql - SQL:组合两个具有公共(public)列但每个都有自己特定的唯一列的查询结果

mysql - 带有 SUM() 和 WHERE 的多个选择语句?

Php:如何扩展库?

php - 重复数据库中的数据?

php - 从多个表中选择,其中 php 变量等于列值

php - 用于检查空闲位置的 Symfony 实体查询构建器

php - mysql查询执行时间太慢