Posted by StevePBurgess on 09/14/06 20:41
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
Navigation:
[Reply to this message]
|