为什么我插入或更新完数据都要刷新一次才能看到新数据呢

maxid 2003-08-29 10:35:08
如一个超链也要刷新一下才能显示新的数据,要不然每个连接还是显示旧的数据?请问是为什么?
...全文
230 21 打赏 收藏 转发到动态 举报
写回复
用AI写文章
21 条回复
切换为时间正序
请发表友善的回复…
发表回复
maxid 2003-09-04
  • 打赏
  • 举报
回复
我解决了~哈哈~
用这个就可以了~我都你的贴发一下~
session_cache_limiter('private, must-revalidate');
bonson 2003-09-04
  • 打赏
  • 举报
回复
问题是由session_cache_limiter('public');引起的!
如果这句去掉,那问题就可以解决了!
但如果一定要session_cache_limiter('public'); 那我很抱歉!我只是发现了问题,而没有解决问题的办法!我也在等高手帮助解决这个问题
freeantfly 2003-09-03
  • 打赏
  • 举报
回复
<script language='javascript'>
function del(id)
{
if(confirm('你真的要删除这个类别吗?'))
{
document.wirite("<meta http-equiv=refresh content=0;url=*.php>");
}
}
</script>
maxid 2003-09-01
  • 打赏
  • 举报
回复
唉,用php的人那么少
maxid 2003-08-31
  • 打赏
  • 举报
回复
我把代码贴出来,大家看看
<?php
session_cache_limiter('public');
session_start();
//print_r($_SESSION);
if ($username == "")
{
echo "<script language='javascript'>\n";
echo "top.location='index.php'\n";
echo "</script>";
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<title>产品类别管理</title>
<link href="../css/dbms.css" rel="stylesheet" type="text/css">
<script language='javascript'>
function del(id)
{
if(confirm('你真的要删除这个类别吗?'))
{
self.location='altersort.php?action=del&id='+id;
}
}
</script>
</head>
<?
require('../Connections/conn.php');

mysql_select_db($database_conn, $conn);

//这里分页,读取数据库模块
if (($_GET["action"] == "") || ($_GET["action"] == "listsort"))
{
$query_sort_Rst = "SELECT * FROM `product_sort` ORDER BY `sort_id` DESC";
$sort_Rst = mysql_query($query_sort_Rst, $conn) or die(mysql_error());
$totalRows_sort_Rst = mysql_num_rows($sort_Rst);
//echo $totalRows_sort_Rst;
//echo $query_sort_Rst;
mysql_free_result($sort_Rst);
$pagesize = 10;
$maxpage = ceil($totalRows_sort_Rst/$pagesize);
//echo "<br>" . $maxpage;
$pagecount = $_GET['pageno'];
if ($_GET['pageno'] == "")
{
$pagecount = 1;
}
if ($pagecount >= $maxpage)
{
$pagecount = $maxpage;
}
$offsetp = $pagesize * $pagecount;
If ($pagecout == 1)
{
$query_limit = "0,10";
}
else
{
$query_limit = $offsetp-$pagesize . ",10";
}
if ($maxpage == 1)
{
$cutpage = "1/1";
}
else
{
$cutpage = $pagecount."/".$maxpage;
}
if ($totalRows_sort_Rst == 1)
{
$cutrow = "1-1";
}
elseif ($offsetp > $totalRows_sort_Rst)
{
$cutrow = ($offsetp-$pagesize+1). "-" . $totalRows_sort_Rst;
}
else
{
$cutrow = ($offsetp-$pagesize+1) . "-" . $offsetp;
}
$query_sort_Rst = "SELECT * FROM `product_sort` LIMIT " . $query_limit;
//echo $query_sort_Rst;
$sort_Rst = mysql_query($query_sort_Rst, $conn) or die(mysql_error());
$row_sort_Rst = mysql_fetch_assoc($sort_Rst);
}
?>
<body bgcolor="#6699CC" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="80%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="middle">
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#333333">
<tr bgcolor="#006699">
<td height="20" colspan="2" align="center"><strong><font color="#FFFFFF">产品类别管理模块</font></strong></td>
</tr>
<tr>
<td width="14%" height="125" align="center" valign="top" bgcolor="#A9C6E2"><table width="100" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table>
<table width="100" border="0" cellspacing="1" cellpadding="0">
<tr>
<td height="30" align="center" bgcolor="#6699CC"><a hidefocus=true href="sort.php?action=addsort">新建类别</a></td>
</tr>
<tr>
<td height="30" align="center" bgcolor="#6699CC"><a hidefocus=true href="sort.php?action=listsort&pageno=1">查看类别</a>
</td>
</tr>
</table>

</td>
<td width="86%" align="center" valign="top" bgcolor="#A9C6E2">
<?
if ($_GET['action'] == "addsort")
{
?>
<table width="450" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table>
<table width="450" border="0" align="center" cellpadding="0" cellspacing="1">
<form method="post" name="form1" action="altersort.php">
<tr valign="baseline">
<td width="80" align="right"><font size="2">新类别名</font></td>
<td width="212"><div align="center">
<input name="sort" type="text" class="mybutton" value="" size="32">
</div></td>
<td width="154"><input name="submit" type="submit" class="mybutton" value="添加">
<input type="hidden" name="addsort" value="form1"></td>
</tr>
</form>
</table>
<?
}
elseif ($_GET['action'] == "listsort")
{
echo $query_sort_Row;
?>
<table width="450" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table>
<table width="450" border="0" cellspacing="1" cellpadding="0">
<tr>
<td height="20" align="center" bgcolor="#6699CC">
<a hidefocus=true href="sort.php?pageno=1&action=listsort">首页 </a><font color="#FFFFFF">|</font>
<? if ((($pagecount-1) < 1) || ($maxpage == 1)) {?>
<font size="2" color="#CCCCCC">上一页 </font>
<? } else {?>
<a hidefocus=true href="sort.php?pageno=<? echo $pagecount-1;?>&action=listsort">上一页</a>
<? }?>
<font color="#FFFFFF">|</font>
<? if (($pagecount+1) > $maxpage) {?>
<font size="2" color="#CCCCCC">下一页</font>
<? } else {?>
<a hidefocus=true href="sort.php?pageno=<? echo $pagecount+1;?>&action=listsort">下一页</a>
<? }?>
<font color="#FFFFFF">|</font>
<a hidefocus=true href="sort.php?pageno=<? echo $maxpage;?>&action=listsort">末页</a>
<font color="#FFFFFF" size="2">当前<? echo $cutpage;?>页 当前<?echo $cutrow?>条 共条<?echo $totalRows_sort_Rst;?>记录</font>
</td>
</tr>
</table>
<table width="450" border="0" cellspacing="1" cellpadding="0">
<tr align="center" bgcolor="#006699">
<td width="150" height="20"><font color="#FFFFFF" size="2">类别ID号</font></td>
<td width="150" height="20"><font color="#FFFFFF" size="2">类别名</font></td>
<td width="150" height="20"><font color="#FFFFFF" size="2">操作</font></td>
</tr>
<?php do { ?>
<tr align="center" bgcolor="#6699CC">
<td width="150" height="20"><?php echo $row_sort_Rst['sort_id']; ?></td>
<td width="150" height="20"><?php echo $row_sort_Rst['sort']; ?></td>
<td width="150" height="20"><a hidefocus=true href="sort.php?action=edit&id=<?php echo $row_sort_Rst['sort_id']; ?>">修改</a><font color="#FFFFFF">|</font><a hidefocus=true href="#" OnClick="del(<?php echo $row_sort_Rst['sort_id']; ?>);">删除</a></td>
</tr>
<?php } while ($row_sort_Rst = mysql_fetch_assoc($sort_Rst)); ?>
<tr align="center">
<td width="150" height="20"> </td>
<td width="150" height="20"> </td>
<td width="150" height="20"> </td>
</tr>
</table>
<?
mysql_free_result($sort_Rst);
}
if ($_GET['action'] == "ecdt")
{
}
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p> </p>

</body>
</html>
<?php
//mysql_free_result($sort_Rst);
mysql_close($conn);
?>
bacp 2003-08-31
  • 打赏
  • 举报
回复
我晕倒中~~~~~~~~```

弱水三千是一个女的吗?
倒~~~~又跑题了~~~~~~
DFlyingchen 2003-08-31
  • 打赏
  • 举报
回复
楼主搞笑啊,跑题了
maxid 2003-08-31
  • 打赏
  • 举报
回复
对啊,就是那样,但是asp为什么不会这样呢~~
leo000 2003-08-31
  • 打赏
  • 举报
回复
不刷新的话可能调用的是本机上的缓存文件。
maxid 2003-08-31
  • 打赏
  • 举报
回复
对啊,跑题了:( 快回到正题,那位兄弟姐妹可以说出个究竟啊?小兄我感激不尽,只是想明白个为什么,因为在www.51.net上的租的空间也是这样(在自己的爱机也是一样)。
加了
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
的话也要刷一次才显出到(连接是也算是刷了一次),但不加上面的代码,有时候刷来刷去还是显示以前的数据。@_@晕啊
clflove 2003-08-30
  • 打赏
  • 举报
回复
使用<meta http-equiv=refresh content=0;url=*.php>
maxid 2003-08-30
  • 打赏
  • 举报
回复
为什么asp不会有这样问题呢?
maxid 2003-08-30
  • 打赏
  • 举报
回复
对,不过改了还是不行~
佛祖的木鱼 2003-08-30
  • 打赏
  • 举报
回复
我想知道的是你的插入数据与显示数据是否在同一个页面执行?如果是的话,那么把插入数据的代码入到RECORDSET记录集前就成了.
maxid 2003-08-30
  • 打赏
  • 举报
回复
我想知道为什么别人不加也很正常啊?
wtoeb 2003-08-30
  • 打赏
  • 举报
回复
在head之间加上下面代码试试:
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
maxid 2003-08-30
  • 打赏
  • 举报
回复
clflove(陈杰)你怎么跟我表哥的名字一样啊?
maxid 2003-08-29
  • 打赏
  • 举报
回复
为什么每按一个连接后都要再刷新一次才会显示新的数据啊,不刷新就显示旧数据,天啊:(
maxid 2003-08-29
  • 打赏
  • 举报
回复
有谁可以解释一下:(
maxid 2003-08-29
  • 打赏
  • 举报
回复
我也不明白啊?
加载更多回复(1)

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧