-1
我有一个项目,用户登录后用户将看到一些society list
。点击它将进入仪表板的特定社会。 因此,如果用户点击社会1后,他应该只显示society-1's
数据。如何在php中设置会话?
<h6>Please select your society</h6>
<?php
$sql = mysqli_query($conn,'select * from `society`');
$_SESSION['society'] = $sql['societyId'];
while ($row = mysqli_fetch_array($sql))
{?>
<h4 style="color: #000;"><i class="fa fa-paw"></i> <a
style="color: black;" href="home.php"><?php echo $row['societyName']?></a>
</h4>
<?php }?>
这是我的代码,显示数据库中的所有社会。现在如果我选择其中任何一个,它应该只显示特定社会的数据。
我在我所有的表中都有societyId
作为外键。
使用session_start()开始会话;在页面顶部和assin像这样$ _SESSION ['nam'] ='value'; – JYoThI
[阅读手册](http://php.net/manual/en/book.session.php)是一个很好的开始。 – aynber