Php 如何使用一些代码将数据插入引导表?
向引导表插入数据时出现问题。代码的某些部分太复杂,无法正确插入到表中 我已经做的是尝试以多种方式将数据插入表中,但到目前为止没有任何效果 这是我想要的原始引导表的样子Php 如何使用一些代码将数据插入引导表?,php,mysqli,html-table,bootstrap-4,Php,Mysqli,Html Table,Bootstrap 4,向引导表插入数据时出现问题。代码的某些部分太复杂,无法正确插入到表中 我已经做的是尝试以多种方式将数据插入表中,但到目前为止没有任何效果 这是我想要的原始引导表的样子 echo '<div class="example-wrap"> <p>Filmsground Users</p> <div class="example table-responsive"> <
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>';
echo'
Filmsground用户
身份证件
用户名
模块访问
编辑
1.
提根
管理
';
以及需要插入到引导表中的代码
$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;
}
}
}
$query=mysqli\u query($conn,“按id从用户订单中选择*);
而($results=mysqli\u fetch\u assoc($query))
{
回声“:”;
如果($results['membertype']=='admin')
{
echo“管理员用户可以访问所有内容。”;
}
其他的
{
$user=$results['username'];
$query\u prev=mysqli\u query($conn,“从username='“$user.”的user\u prev中选择*);
而($prevs=mysqli\u fetch\u assoc($query\u prev))
{
$pattern='/\[module\](.*?\[\/module\]/is';
$replace='$1';
$module_name=preg_replace($pattern,$replace,$prevs['prevs']);
echo$module_name;
}
}
}
PHP可以与html齐头并进。您可以使用这种方式:
<?php
if (mysqli_num_rows($result2) > 0)
{
while($row4 = mysqli_fetch_assoc($result2))
{
?>
<tbody id="myTable">
<tr >
<td align="center"><?php echo $row4['articleID'];?>
</td>
<td align="center"><?php echo $row4['articleName'];?>
</td >
<td align="center"><?php echo $sordCodeFO; ?>
</td>
<td align="center"><?php echo $row4['color'];?>
</td>
<td align="center"><?php echo $row4['style'];?>
</td>
<td align="center"><?php echo $row4['size'];?>
</td>
<td align="center"><?php echo $row4['quantity'];?>
</td></tr></tbody>
<?php
}
}
?>
PHP可以与html齐头并进。您可以使用这种方式:
<?php
if (mysqli_num_rows($result2) > 0)
{
while($row4 = mysqli_fetch_assoc($result2))
{
?>
<tbody id="myTable">
<tr >
<td align="center"><?php echo $row4['articleID'];?>
</td>
<td align="center"><?php echo $row4['articleName'];?>
</td >
<td align="center"><?php echo $sordCodeFO; ?>
</td>
<td align="center"><?php echo $row4['color'];?>
</td>
<td align="center"><?php echo $row4['style'];?>
</td>
<td align="center"><?php echo $row4['size'];?>
</td>
<td align="center"><?php echo $row4['quantity'];?>
</td></tr></tbody>
<?php
}
}
?>
谢谢你的建议,但我想按原样去做!谢谢你的建议,但我想用它的方式!