Jump to content

IE/Firefox compatability


mikeg542

Recommended Posts

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[

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.