|
-
Dec 9th, 2004, 01:53 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] IE Refresh Issues
I have the code below, and the issue I'm having is when you run the script the first time in your browser and say the url is:
filename.php?option=append
That works fine. But say you edit the url to:
filename.php?option=redo
while still in the same browser window and then hit the green GO button on internet explorer. The message comes up saying the database rebuild was successful, but it actually doesnt do the rebuild. You actually have to hit the Refresh button in IE to make the MySQL rebuild actually occur. Does anyone know why?
I find it wierd it echoes the right text but doesnt perform the other code. Please help
PHP Code:
<?php
if($_GET['option'] == "")
{
$_GET['option'] = "append";
}
require('databaseparameters.php');
if($_GET['option'] == "append")
{
$fcontents = file ($csv_filename);
$dbh = mysql_connect("localhost", $db_user, $db_pass);
mysql_select_db($db_name);
for($i=0; $i<sizeof($fcontents); $i++)
{
if($i != 0)
{
$line = trim($fcontents[$i]);
$arr = explode(",", $line);
$sql = "INSERT INTO ".$table_name." VALUES ('".implode("','", $arr) ."')";
mysql_query($sql);
}
}
echo "Data Appended To MySQL Database!";
}
elseif($_GET['option'] == "redo")
{
$fcontents = file ($csv_filename);
$dbh = mysql_connect("localhost", $db_user, $db_pass);
mysql_select_db($db_name);
//EMPTY THE TABLE FIRST
$sql = "DELETE FROM ".$table_name;
mysql_query($sql);
for($i=0; $i<sizeof($fcontents); $i++)
{
if($i != 0)
{
$line = trim($fcontents[$i]);
$arr = explode(",", $line);
$sql = "INSERT INTO ".$table_name." VALUES ('".implode("','", $arr) ."')";
mysql_query($sql);
}
}
echo "MySQL Database Rebuild Complete!";
}
else
{
echo "Error: Option Invalid";
}
?><?php
if($_GET['option'] == "")
{
$_GET['option'] = "append";
}
require('databaseparameters.php');
if($_GET['option'] == "append")
{
$fcontents = file ($csv_filename);
$dbh = mysql_connect("localhost", $db_user, $db_pass);
mysql_select_db($db_name);
for($i=0; $i<sizeof($fcontents); $i++)
{
if($i != 0)
{
$line = trim($fcontents[$i]);
$arr = explode(",", $line);
$sql = "INSERT INTO ".$table_name." VALUES ('".implode("','", $arr) ."')";
mysql_query($sql);
}
}
echo "Data Appended To MySQL Database!";
}
elseif($_GET['option'] == "redo")
{
$fcontents = file ($csv_filename);
$dbh = mysql_connect("localhost", $db_user, $db_pass);
mysql_select_db($db_name);
//EMPTY THE TABLE FIRST
$sql = "DELETE FROM ".$table_name;
mysql_query($sql);
for($i=0; $i<sizeof($fcontents); $i++)
{
if($i != 0)
{
$line = trim($fcontents[$i]);
$arr = explode(",", $line);
$sql = "INSERT INTO ".$table_name." VALUES ('".implode("','", $arr) ."')";
mysql_query($sql);
}
}
echo "MySQL Database Rebuild Complete!";
}
else
{
echo "Error: Option Invalid";
}
?>
Last edited by stickman373; Dec 11th, 2004 at 02:24 PM.
-
Dec 9th, 2004, 02:47 PM
#2
Frenzied Member
Re: IE Refresh Issues
I think it would do it in any browser, not just IE. It's because you're going to the same page and the browser is loading it from cache, ignoring the parameters. Refreshing actually makes it look at the parameters in the URL and then it reparses the contents of the page.
In other words, it has nothing to do with your script.
-
Dec 9th, 2004, 02:54 PM
#3
Thread Starter
Fanatic Member
Re: IE Refresh Issues
Alright thanks for the info on that.
I was able to put meta tags at the start of the file to force browser not to use cache.
Thanks
-
Dec 10th, 2004, 07:45 AM
#4
Re: IE Refresh Issues
That's weird, though. The fact that the GET parameters changed means that the request is a different one, thus the browser should be REQUIRED to re-fetch.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|