如何使此会话读取另一个会话。 当此会话声明内部视图数据.php时,它无法获取此会话。
<?php
session_start();
error_reporting(0);
include('../includes/config.php');
if(strlen($_SESSION['alogin']) == 0){
header('location:index.php');
}
?>
这是用于查看数据的代码。我需要该id
将所有数据库放入另一个数据库。
<td>
<a href="view-data.php?edit=<?php echo $result->id;?>" onclick="return confirm('Do you want to Complete ?');"> <i class="fa fa-pen"></i></a>
</td>
我尝试声明get from id
但它仍然没有显示结果。
//Checking user login
$npp = $_SESSION['alogin'];
$sql = "SELECT * from users where npp = (:npp);";
$query = $dbh -> prepare($sql);
$query-> bindParam(':npp', $npp, PDO::PARAM_STR);
$query->execute();
$results=$query->fetchAll(PDO::FETCH_OBJ);
foreach($results as $result) {
$Snama=htmlentities($result->name);
$Sjob=htmlentities($result->job);
$SOffice=htmlentities($result->office);
}
<a><?php echo htmltieties(result->name);?></a><br>
<a><?php echo $Snama;?> </a>
使"session_start((;"在所有页面上都可以访问或将其添加到每个页面上