$username = $_SESSION['userName'];$user_query = "select * from user where id=$userid limit 1";$query = mysqli_query($link,$user_query);
echo '用户ID:'.$userid.'
';
echo '用户名:'.$username.'
';$sql="SELECT * FROM messageboard ORDER BY id DESC";
$res = mysqli_query($link, $sql);
echo "
";?>
用户名 |
留言标题 |
留言内容 |
操作 |
while ($row = mysqli_fetch_array($res,MYSQLI_BOTH)) {?>
| | | |
回复内容:
$username = $_SESSION['userName'];$user_query = "select * from user where id=$userid limit 1";$query = mysqli_query($link,$user_query);
echo '用户ID:'.$userid.'
';
echo '用户名:'.$username.'
';$sql="SELECT * FROM messageboard ORDER BY id DESC";
$res = mysqli_query($link, $sql);
echo "
";?>
用户名 |
留言标题 |
留言内容 |
操作 |
while ($row = mysqli_fetch_array($res,MYSQLI_BOTH)) {?>
| | | |
一般情况下都是用户登录了之后有个个人中心,个人中心里面是可以用来修改自己的留言这些的,难道题主你是想直接在所有的留言下面判断哪条留言是目前用户的么,然后就可以直接编辑?这么多是不是有点不好呢?
<code>$sql = "SELECT * FROM message as m left join user as u on m.uid = u.uid";
$res = mysqli_query($sql,$link);
while ($row = mysqli_fetch_assoc($res)) {
$rows[] = $row;
}
echo '<table border="1" align="center" width="800">';
foreach ($rows as $key => $value) {
echo '<tr>';
echo '<td>用户名:'.$value['username'].'</td>';
echo '<td>留言标题:'.$value['title'].'</td>';
echo '<td>留言内容:'.$value['info'].'</td>';
if($value['uid'] == $_SESSION['uid']){
echo '<td>操作:编辑留言</td>';
}else{
echo '<td>操作:无法编辑</td>';
}
echo '</tr>';
}
echo '</table>';
</code>
不知道是不是想要这种的,没看懂你的
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn