php把数据库查出来的放到session 为什么取不出来 10
页面1连接数据库查询之后session_start();$table=array();while($row=mysql_fetch_row($result)){$tabl...
页面1连接数据库查询之后
session_start();
$table = array();
while($row=mysql_fetch_row($result)){
$table[]=$row;
}
$_SESSION['table']=$table;
页面二 输出session
session_start();
$table = $_SESSION['table'];
echo "<table>";
for($g=0;$g<count($table);$g++)
echo "<tr>";
for($i=0;$i<count($table[$g]);$i++){
echo "<td>";
echo $table[$g][$i];
echo "</td>";
}
echo "</tr>";
}
echo "</table>"; 展开
session_start();
$table = array();
while($row=mysql_fetch_row($result)){
$table[]=$row;
}
$_SESSION['table']=$table;
页面二 输出session
session_start();
$table = $_SESSION['table'];
echo "<table>";
for($g=0;$g<count($table);$g++)
echo "<tr>";
for($i=0;$i<count($table[$g]);$i++){
echo "<td>";
echo $table[$g][$i];
echo "</td>";
}
echo "</tr>";
}
echo "</table>"; 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询