header("Location:...") much faster then http-equiv="refresh"? too fast?
| From: | Avi Schwartz | Date: | Thu, 22 Nov 2001 06:40:16 +0000 |
| Subject: | header("Location:...") much faster then http-equiv="refresh"? too fast? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-75475@lists.php.net to get a copy of this message | ||
Hi,
I have a strange problem. I have a page that displays a list of records.
When the user clicks on the delete link by one of the records, a php script
is taking care to delete that specific record and then redirects back to
the record list.
I use PEAR::DB with MySQL.
When I use header("Location: ...") to redirect the user back to the record
list page, many times the screen still displays the old list and I have to
refresh the page so see that the record was deleted. At first I thought
that the page is redisplayed from the cache so I added the appropriate meta
tags to make sure that the page will not be cached by the browser. Since
sometimes it worked and sometimes it didn't, I started suspecting the the
problem may be with the fact that the database (mysql) may have not removed
the record yet by the time the record list is redisplayed. I decided to
try to use the http-equiv="refresh" meta tag with a delay of 1 second, and
suddenly the problem has disappeared. I also worked by setting the delay
to 0.
Does the above suspicion I have even make sense? Why would mysql not
complete the delete when the delete is executed?
Avi
--
Avi Schwartz
avi@CFFtechnologies.com
"I have to share the credit. I invented it, but Bill made it
famous." - IBM engineer Dave Bradley describing the
control-alt-delete reboot sequence