【发布时间】:2019-05-31 19:45:33
【问题描述】:
在将数据插入引导表时遇到问题。部分代码太复杂,无法正确插入表格!
我已经尝试通过多种方式将该数据插入到表中,但到目前为止没有任何效果!
这是我想要的原始引导表!
echo '<div class="example-wrap">
<p>Filmsground Users</p>
<div class="example table-responsive">
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Username</th>
<th>Modules Access</th>
<th>Edit</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Teagan</td>
<td>
<span class="label label-danger">admin</span>
</td>
<td>
<button type="button" class="btn btn-sm btn-icon btn-flat btn-default" data-toggle="tooltip"
data-original-title="Edit">
<i class="icon wb-wrench" aria-hidden="true"></i>
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>';
以及需要插入引导表的代码!
$query = mysqli_query($conn, "SELECT * FROM users ORDER BY id ASC");
while ($results = mysqli_fetch_assoc($query))
{
echo '<p><strong><a href="?inav=useredit&id='.$results['id'].'">'.$results['username'].'</a></strong>: ';
if ($results['membertype'] == 'admin')
{
echo 'Admin users have access to everything.';
}
else
{
$user = $results['username'];
$query_prev = mysqli_query($conn, "SELECT * FROM user_prevs WHERE username='".$user."'");
while ($prevs = mysqli_fetch_assoc($query_prev))
{
$pattern = '/\[module\](.*?)\[\/module\]/is';
$replace = '$1 ';
$module_name = preg_replace($pattern, $replace, $prevs['prevs']);
echo $module_name;
}
}
}
【问题讨论】:
标签: php mysqli html-table bootstrap-4