DiscoTrio Posted December 1, 2009 Share Posted December 1, 2009 This is always an ordeal with me. I use firefox and get something working and ie comes along and ends my fun. If anyone knows a problem in the script that could cause this please tell me. When the following script is ran on Internet Explorer 8 its works but keeps refreshing continuously. <?$con = mysql_connect("localhost","bmvybfbk_master","74SAc194G"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("bmvybfbk_website", $con); $result = mysql_query("SELECT * FROM comments WHERE flagged = '1'"); while($row = mysql_fetch_array($result)) {$cnumber = $row['id']; echo $row['writer'] . " wrote:<br>" . $row['comment']; echo "<br><a href='mod2.php?action=ignore&cnumber=$cnumber'>[ignore]</a>"; echo " <a href='mod2.php?action=delcomment&cnumber=$cnumber'>[Delete]</a>"; echo "<br>----------------------------------------------------------------------------------------------------<br>";} if ($action == ignore) { mysql_query("UPDATE comments SET flagged = '0' WHERE id = '$cnumber' LIMIT 1");?> <meta http-equiv="refresh" content="0;mod2.php"><?} if ($action == delcomment) {mysql_query("DELETE FROM comments WHERE id='$cnumber' LIMIT1");?> <meta http-equiv="refresh" content="0;url=mod2.php"><?} else {echo " ";} }else{ echo "*You Don't Have any rights to View this page*'";}?> Sorry, codes a bit messy but functions perfect in firefox..... Quote Link to comment https://forums.phpfreaks.com/topic/183514-internet-explorer-goes-into-hyper-refresh-when-this-script-is-ran/ Share on other sites More sharing options...
.josh Posted December 1, 2009 Share Posted December 1, 2009 unless you have globals set to on, there's no such thing as $action. You should be using $_GET['action'] And you don't have quotes around the stuff it is supposed to be compared against (ignore, delcomment). I'm assuming you also have error reporting turned off, otherwise you would have gotten a warning about both of those things. Anyhow, seeing as how false == false, your conditions that are outputting the meta tags set to refresh over and over, are being output. Since you say it is being refreshed over and over, either mod2.php is the name of this script, or else mod2.php is redirecting to this script. The reason why it works "perfectly" in FF is probably because it's detecting something is amiss and preventing it from doing it, as opposed to IE happily doing it for you. Quote Link to comment https://forums.phpfreaks.com/topic/183514-internet-explorer-goes-into-hyper-refresh-when-this-script-is-ran/#findComment-968634 Share on other sites More sharing options...
DiscoTrio Posted December 1, 2009 Author Share Posted December 1, 2009 Hmmm, I have never heard of putting quotes around thing being compared in script(can you show a quick example), and $action is defined earlier. Quote Link to comment https://forums.phpfreaks.com/topic/183514-internet-explorer-goes-into-hyper-refresh-when-this-script-is-ran/#findComment-968637 Share on other sites More sharing options...
mikesta707 Posted December 1, 2009 Share Posted December 1, 2009 when you compare a variable to a string, you SHOULD surround the string with quotes. IE instead of if ($action == ignore) { it should be if ($action == 'ignore') { when you have a string without quotes, PHP thinks you are using a global variable. IE define("globalVar", "value"); //now I can just use globalVar like so echo globalVar; However, PHP is smart enough to realize when you messed up, and meant a string (as PHP will assume you meant a string, when no global variable of that name is found) As CV said, you should turn error reporting on, so PHP can give you some feedback to why your script isn't working. error_reporting(E_ALL); ini_set("display_errors", 1); you say action is defined above? echo $action and post what its value is. Or better yet, post the code where $action is defined Quote Link to comment https://forums.phpfreaks.com/topic/183514-internet-explorer-goes-into-hyper-refresh-when-this-script-is-ran/#findComment-968642 Share on other sites More sharing options...
DiscoTrio Posted December 1, 2009 Author Share Posted December 1, 2009 I believe I forgot to mention the address is initially http://gamepage101.com/mod2.php but when buttons are clicked more is added to the address. I get action with this: $action = ($_GET['action']); Which is apparently working. I made any changes above but still does same thing... Quote Link to comment https://forums.phpfreaks.com/topic/183514-internet-explorer-goes-into-hyper-refresh-when-this-script-is-ran/#findComment-968659 Share on other sites More sharing options...
mikesta707 Posted December 1, 2009 Share Posted December 1, 2009 ok, when you echo action, what value does it have? It would seem that you keep passing the same value for that $_GET variable every time you refresh the page, and gets locked into an infinite refresh loop Quote Link to comment https://forums.phpfreaks.com/topic/183514-internet-explorer-goes-into-hyper-refresh-when-this-script-is-ran/#findComment-968673 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.