PHP是否“缓存”脚本? [英] Does PHP "cache" scripts?
问题描述
一个非常简单的脚本让我起了作用。
我在网站上有一个非常简单的设施,允许用户重新订购
项目在数据库表中,通过点击一个链接(在
这种情况下)说向上移动并链接到下面的脚本。
显示完成所有工作的脚本片段 - 数据库
建立连接并在完成其工作后的脚本返回
用户到引用页面。
---------------------- -----------------------
$ sql ="从CreditType中选择DisplayOrder,其中Id =" 。 $ credcat;
$ result = mysql_query($ sql);
$ row = mysql_fetch_row($ result);
$ sql =" update CreditType set DisplayOrder =" 。 (($ row [0]) - 1)。 "其中
Id =" 。 $ credcat;
mysql_query($ sql);
$ sql =" update CreditType set DisplayOrder =" 。 ($ row [0])。其中
DisplayOrder =" 。 (($ row [0]) - 1)。 "和Id<>" 。 $ credcat;
mysql_query($ sql);
--------------------- -----------------------
在我自己的服务器上,这很有效 - 但是当我上传到我的服务器时
客户端的共享服务器有时可以工作,有时也不行。这是间歇性的
。
PHP可以返回脚本的缓存结果吗?如果不是,地球上的什么可以发生?如果是的话,我可以通过
脚本来禁止这种情况(我无法更改共享主机上的任何设置)。
非常感谢。
Steve
A really simple script is driving me up the wall.
I have a very simply facility on a website to allow the user to reorder
items in a database table as she wishes by clicking a link that (in
this case) says "MOVE UP" and links to the script below.
This script snippet that does all the work is shown - the database
connection is established and after doing its work the script returns
the user to the referring page.
---------------------------------------------
$sql="select DisplayOrder from CreditType where Id=" . $credcat;
$result=mysql_query($sql);
$row=mysql_fetch_row($result);
$sql="update CreditType set DisplayOrder=" . (($row[0])-1) . " where
Id=" . $credcat;
mysql_query($sql);
$sql="update CreditType set DisplayOrder=" . ($row[0]) ." where
DisplayOrder=" . (($row[0])-1) . " and Id<>" . $credcat;
mysql_query($sql);
--------------------------------------------
On my own server this works perfectly - but when I upload it to my
client''s shared server it sometimes works and sometimes doesn''t. It is
intermittent.
Could PHP be returning a cached result of the script? If no, what on
earth can be happening? If yes, can I stop this from happning from the
script (I can''t change any settings on the shared host).
Many thanks.
Steve
推荐答案
sql ="从CreditType中选择DisplayOrder,其中Id =" 。
sql="select DisplayOrder from CreditType where Id=" .
credcat;
credcat;
result = mysql_query(
result=mysql_query(
这篇关于PHP是否“缓存”脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!