麻辣堂|资源主站|开发论坛|在线手册
首页 Apache Linux Java MySQL 注册帮助 
PHP项目开发组是PHP开发资源网于2007组年建成立的项目开发团队,目前核心开发成员有27人, 项目协作成员8名.下设7个开发组,主要承接大/中型网站项目开发任务。

    由于开发任务较多,人员比较紧张,现面向社会招聘全职或者兼职开发人员,不管你是在校大学生,还是全职开发人员,以及SOHO都可以联系本站,我们可以长期合作,并为您带来丰厚的报酬。
  您现在的位置:PHP开发资源网 > 麻辣堂 > 详细资料
待解决
数据库缓存
悬赏分:20 - 2007年08月22日

[php]<? $n=0; while($n<5) { $url="xxx.htm"; $data=parsedata($url); $addtime=time(); $url=""; $sql="insert into xxxx set n='$n'"; echo $sql."
"; //此处输出$sql不重复 mysql_query($sql); $csql="insert into yyy...."; mysql_query($csql); $n++; } function parsedata($url) { ob_start(); readfile($url); $contentdata= ob_get_contents(); ob_end_clean(); return $contentdata; } ?> <? 结果: //--------------------------------------- 页面显示结果 insert into xxxx set n='0' insert into xxxx set n='1' insert into xxxx set n='2' insert into xxxx set n='3' insert into xxxx set n='4' 循环5次,出现5条. 数据库结果. 程序改动一下.数据库插入正常,插入5条 insert into xxxx set n='0' insert into xxxx set n='1' insert into xxxx set n='2' insert into xxxx set n='3' insert into xxxx set n='4' //------------------------------------ 程序不改动的情况下大于2次执行. 页面显示结果正常. insert into xxxx set n='0' insert into xxxx set n='1' insert into xxxx set n='2' insert into xxxx set n='3' insert into xxxx set n='4' 循环5次,出现5条. 但是数据库结果有时候正常,有时候不正常. 会出现重复现象. //第1种异常 insert into xxxx set n='0' insert into xxxx set n='0' insert into xxxx set n='1' insert into xxxx set n='1' insert into xxxx set n='2' insert into xxxx set n='2' insert into xxxx set n='3' insert into xxxx set n='3' insert into xxxx set n='4' insert into xxxx set n='4' //第2种异常,交替重复 insert into xxxx set n='0' insert into xxxx set n='1' insert into xxxx set n='0' insert into xxxx set n='1' insert into xxxx set n='2' insert into xxxx set n='3' insert into xxxx set n='2' insert into xxxx set n='3' insert into xxxx set n='4' insert into xxxx set n='4' //第3种正常 insert into xxxx set n='0' insert into xxxx set n='1' insert into xxxx set n='2' insert into xxxx set n='3' insert into xxxx set n='4' //=========================================================== 1.应用了这些函数造成的. ob_start(); readfile($url); $contentdata= ob_get_contents(); ob_end_clean(); 我试了一下,应用ob_flush(),ob_end_flush() ,flush(),解决不了问题. 2.我认为是数据库结果缓存造成的.这个如何清除缓存? FLUSH flush_option [,flush_option]? 哪个参数能解决上述问题,并且效率高的? 3.还是其他原因? ?>[/php]

提问者:wangcnc2005   08-22 16:04
答复
路过。。。顺便帮顶:)
回答者:玉米づ冰冻可乐 - 瓦岗村民 8-22 09:10
我也来回答:
不管你有没有帮助我们,瓦岗寨8万村民将感谢你。。。。。

为防止灌水,您需要计算一道数学题: 答案:
89 + 15 = ? 请将计算结果填在上面

 
[]
©2007 PhpRes.COM