我做了一个页面,代码如下。不知道为什么,我每次刷新一遍。session就会被清空!index.php页面。不知道为什么。让我很郁闷。别人都没有这个问题。就我出现了出个问题。另外我在php里面把自动会话弄成了1也不行。最后又变回来了。!<? session_start();
$id=$_GET["id"];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>主页</title>
<link href="css/black.css" rel="stylesheet" type="text/css" />
</head><body>
<? include "top.php";
include "conn/conn.php";
?>
<?
if($_SESSION["userName"]!="")
{
?>
<table width="765" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="left" class="black"><?
echo "欢迎".$_SESSION["userName"]."来到这里!";
?></td>
</tr>
</table>
<? }
else
{
include "login.php";
}
?><?
include"conn/conn.php";
$sql="select * from t_category";
$result=mysql_query($sql) or die(mysql_error());
while($info=mysql_fetch_array($result))
{
?>
<table width="765" height="150" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#F3F3F3">
<tr>
<td valign="top"><table width="765" height="80" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#F7F7F7">
<tr>
<td width="20%" rowspan="3" align="center" valign="top" class="black"><img src="<?=$info[pic];?>" width="120" height="90"/></td>
<td width="60%" rowspan="2" align="center" class="black"><a href="readMsg.php?category=<?=$info[category];?>"><?=$info[category];?></a></td>
<td width="20%" class="black">创建日期:<?=$info[buildDate];?></td>
</tr>
<tr>
<td width="20%" class="black">主题总数:</td>
</tr>
<tr>
<td width="60%" align="left" class="black">版主:<?=$info[master];?></td>
<td width="20%" class="black">今日主题:</td>
</tr>
</table></td>
</tr>
</table>
<?
}
?>
<? include "bottom.php";?>
</body></html>
$id=$_GET["id"];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>主页</title>
<link href="css/black.css" rel="stylesheet" type="text/css" />
</head><body>
<? include "top.php";
include "conn/conn.php";
?>
<?
if($_SESSION["userName"]!="")
{
?>
<table width="765" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td align="left" class="black"><?
echo "欢迎".$_SESSION["userName"]."来到这里!";
?></td>
</tr>
</table>
<? }
else
{
include "login.php";
}
?><?
include"conn/conn.php";
$sql="select * from t_category";
$result=mysql_query($sql) or die(mysql_error());
while($info=mysql_fetch_array($result))
{
?>
<table width="765" height="150" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#F3F3F3">
<tr>
<td valign="top"><table width="765" height="80" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#F7F7F7">
<tr>
<td width="20%" rowspan="3" align="center" valign="top" class="black"><img src="<?=$info[pic];?>" width="120" height="90"/></td>
<td width="60%" rowspan="2" align="center" class="black"><a href="readMsg.php?category=<?=$info[category];?>"><?=$info[category];?></a></td>
<td width="20%" class="black">创建日期:<?=$info[buildDate];?></td>
</tr>
<tr>
<td width="20%" class="black">主题总数:</td>
</tr>
<tr>
<td width="60%" align="left" class="black">版主:<?=$info[master];?></td>
<td width="20%" class="black">今日主题:</td>
</tr>
</table></td>
</tr>
</table>
<?
}
?>
<? include "bottom.php";?>
</body></html>
解决方案 »
- 如何打开80端口?
- 请看一个dz论坛的sql实例,研究一下mysql的left join到底是如何工作的?
- 请问php是把session保存为文件。何时被自动删除
- 本人想写一个比较通用的新闻产品管理系统,但不知道从哪里入手
- 能不能同时存在两个MYSQL的连接?
- 各位,小弟我很受伤!因此有忙请大家帮.谢谢
- 在WIN2000下使用PHP,配套的用什么数据库好?MS SQL还是MYSQL?哪个速度快?
- Zend Cache for linux php 4.04 & 4.03 下载!!!!!!!
- 咨询关于mysql_connect超时连接
- php伪静态
- javascript 中奇怪的数据转换问题,求教高人???
- 初学php,关于类的疑问~~~
我用的是IE.我在其他的机子上面也是不行! 刚刚我用了世界之窗。也8行!
就是把session 的自动变成了手动。然后又变成自动了!4楼在说的具体一点。那里的设置问题?