javascript - 会话在锚标记中不起作用
问题描述
我将会话传递到循环中的下一页,在那里我得到不同的 $post_id 值,但它似乎取 1 个值,并且没有改变。
<?php
include('dataconnect.php');
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " .$conn->connect_error);
}
$sql = "SELECT * FROM user";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$post_id = "{$row['id']}";
?>
<a href="comment.php?<?php $_SESSION['user_id'] = intVal($post_id); ?>" >Comment</i></a>
<?php }
}
$conn->close();
?>
解决方案
i changed this, hope this help!
<a href="comment.php?session=<?php echo $_SESSION['user_id'] = intVal($post_id); ?>" >Comment</i></a>
推荐阅读
- html - 如何使用两个单独的子 div 的元素更改显示顺序?
- javascript - 在 iOS 浏览器中通过 Ajax 请求的图像未显示,但已加载并在 DOM 中
- highcharts - highcharts 条形图应从该行开始
- laravel - laravel 社交名流不使用 JWT 身份验证
- django - Django 构建错误运行时翻译
- kubernetes - 多个入口在 kubernetes 中不起作用
- java - JPA 请求问题:查询方法 public abstract java.util.List 的验证失败
- javascript - 自动触发点击 JavaScript 功能
- makefile - makefile“删除中间文件”只是有时
- ruby - Rspec 不模拟请求