我想在my index.php中调用导航之前将值发送到导航文件
索引.php
<?php
session_start();
$bookPage = 115;
//Sending bookpage value to navigation.php
$_SESSION['bookpage'] = $bookPage;
// Here I am including the value in navigation
include 'includes/navigation.php';
// Here I am expecting output from navigation $bookPage = 115 and relative query results
?>
导航.php
<?php
$bookPage = $_SESSION['bookpage'];
$sql2 = "SELECT * FROM page_categories WHERE book_page='$bookPage'";
$pquery = $db->query($sql2);
?>
注意:如果我使用$sql2=“select*from page\u categories where book\u page='115'”;在navigation.php中,一切正常。
我没有把navigation.php放在index.php的顶部,因为那样我就不会得到结果,所以我试着这样做,但仍然不起作用。
暂无答案!
目前还没有任何答案,快来回答吧!