damerit Posted June 18, 2008 Share Posted June 18, 2008 I added code to the top of my page to log users and I get a double entry sometimes when I am using IE, but it doesn't do it in FireFox. session_start(); require_once('Connections.php'); $q = "insert into log (logid, userid, timestamp) VALUES ('$dtid', '$userid', '$submitDate')"; mysql_query($q, $DTDB) or die (mysql_error()); Problem: Once I moved it to the production it posts twice to the database, but it doesn't post twice all the time. It is random when I use IE 6.0. When I use Mozilla I don't have this problem. Are there any suggestions as to why this would post twice in IE 6.0? Link to comment https://forums.phpfreaks.com/topic/110798-ie-double-insert-vs-mozilla-single-insert/ Share on other sites More sharing options...
revraz Posted June 18, 2008 Share Posted June 18, 2008 Assuming your term "post" means you are getting two rows inserted instead of just one. If so, then the only way that would happen is if the query was executed twice. Link to comment https://forums.phpfreaks.com/topic/110798-ie-double-insert-vs-mozilla-single-insert/#findComment-568487 Share on other sites More sharing options...
damerit Posted June 18, 2008 Author Share Posted June 18, 2008 Yes, what I mean is that the insert statement is being initiated twice on some istances in IE. It happens often in IE. When I use FireFox it doesn't happen at all. I have the link change colors when it has been clicked on and a running count of how many times it has been clicked on. I can't seem to figure out why this is browser related. There is no onload or reload event taking place. thx.. Link to comment https://forums.phpfreaks.com/topic/110798-ie-double-insert-vs-mozilla-single-insert/#findComment-568520 Share on other sites More sharing options...
revraz Posted June 18, 2008 Share Posted June 18, 2008 Usually when it changes behavior when you use different browsers, it's due to HTML errors or incorrect usage. If you post more of your code, maybe someone can spot the problem. Link to comment https://forums.phpfreaks.com/topic/110798-ie-double-insert-vs-mozilla-single-insert/#findComment-568521 Share on other sites More sharing options...
damerit Posted June 18, 2008 Author Share Posted June 18, 2008 This is all I have on the page and it still inserts twice randomly... <?php session_start(); require_once('Connections.php'); $user = $_SESSION['valid']; if(isset($user)){ } else{ header('Location: login.php'); } mysql_select_db($database_DT, $DB); $nowDate = date('Y-m-d H:i:s'); $submitDate = date('Y-m-d H:i:s'); $id = $_GET['id']; $q = "insert into log (logid, userid, timestamp) VALUES ('$id', '$user', '$submitDate')"; mysql_query($q, $DB) or die (mysql_error()); echo $id; ?> Link to comment https://forums.phpfreaks.com/topic/110798-ie-double-insert-vs-mozilla-single-insert/#findComment-568538 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.