mikeg542 Posted April 21, 2009 Share Posted April 21, 2009 I have a program that once a button has been clicked and the page has reloaded it runs an external script with ajax to check if the database has updated. For some reason it works perfect in firefox 3.0.8 but refuses to work after the first load in IE 7. Does setInterval() not work in IE 7 or is it something else? Here's the relevant code The main page <head> <? include 'databaseinfo.php'; include 'show.php'; $user=$_COOKIE['user']; $query = mysql_query("SELECT id from Users where user=$user"); $row = mysql_fetch_assoc($query); $user = $row['id']; if(isset($_GET['id'])) { ?> <script type="text/javascript" src="jquery-1.3.2.min.js"></script> <script language="javascript" type="text/javascript"> var int=self.setInterval("clock()",1000) function clock() { $('.checky').load('load.php?id='+'<?php echo $row['id']?>'+'&user='+'<?php echo $user?>'); } </script> <? } ?> </head> <body> <?php if(!isset($_GET['id'])) { ?> <div class='checky'> <?php $quer = mysql_query("SELECT cards FROM table1 where player='$user'"); $row = mysql_fetch_assoc($quer); $cardpiece = explode(":", $row['cards']); $num = sizeof($cardpiece)-1; for ($x=0;$x<$num;$x++) { $card = $cardpiece[$x]; $card = mysql_real_escape_string($card); $query = mysql_query("SELECT id FROM tab where name='$card'"); $row = mysql_fetch_assoc($query); $name = $row['id']; ?> <a href=self.php?id=<? echo $name?>><? echo stripslashes(stripslashes($card))?></a> <?php echo "<BR>"; } ?> </div> <? } if(isset($_GET['id'])) { $tempuser = $_COOKIE['user']; $query = mysql_query("SELECT id from Users where user='$tempuser'"); $row = mysql_fetch_assoc($query); $query1 = "UPDATE table1 SET haspicked='yes' WHERE player=".$row['id']; $query = mysql_query($query1); $query = mysql_query("SELECT * from Users where user=$user"); $id=$_GET['id']; ?> <div class='checky'> </div> <? } ?> </body> </html> load.php <? include 'databaseinfo.php'; $user = $_GET['user']; $card = $_GET['id']; $rs="SELECT * from table1 WHERE player=".$user; $query = mysql_query($rs); $row = mysql_fetch_assoc($query); $rs1="SELECT * from table1 WHERE nextplayer=".$user; $query1 = mysql_query($rs1); $row2 = mysql_fetch_assoc($query1); if ($row2['haspicked']=='yes') { echo "Passed!1"; } ?> Thanks for any hel[ Quote Link to comment https://forums.phpfreaks.com/topic/155074-iefirefox-compatability/ Share on other sites More sharing options...
markjoe Posted April 21, 2009 Share Posted April 21, 2009 I thought I remembered some differences with setInterval/setTimeout in IE6, but I just tested a setInterval in IE7 and found no trouble. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <script type='text/javascript'> function one(){ document.getElementById('one').innerHTML = parseInt(document.getElementById('one').innerHTML)+1; } </script> </head> <body> <script type='text/javascript'> setInterval('one()', 1000); </script> <div id='one'>0</div> </body> </html> This worked identically in IE7, Firefox 3 and Chrome. Quote Link to comment https://forums.phpfreaks.com/topic/155074-iefirefox-compatability/#findComment-815819 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.