br3nn4n Posted November 25, 2008 Share Posted November 25, 2008 So this one really has me stumped. Why is my query being run twice when I click submit? It shows the page, blinks, then shows the page again. code that processes it: if (isset($_GET['new']) && $_GET['new']=='add') { require ('../...................inc.php'); mysql_connect($host,$user,$pass); mysql_select_db('..................'); @$_GET['question'] = $question; @$_GET['c1'] = $c1; @$_GET['c2'] = $c2; @$_GET['c3'] = $c3; @$_GET['c4'] = $c4; if ($question == "" || $c1 == "" || $c2 == "" || $c3 == "" || $c4 == "") { echo "Missing something...try again."; mysql_close(); exit; } mysql_query("INSERT INTO ......... (`......`,`.......`,`...........`,`.............`,`.............`,`..............`) VALUES ('','$question','$c1','$c2','$c3','$c4')") or die(mysql_error()); echo "Your poll was added. It will now show up on the site, as the latest poll. <a href='index.php?do=poll'>Return to polls</a>"; mysql_close(); exit; Did I blank enough private stuff out? Thanks for any ideas.. Quote Link to comment https://forums.phpfreaks.com/topic/134207-firefox-running-a-query-twice/ Share on other sites More sharing options...
revraz Posted November 25, 2008 Share Posted November 25, 2008 With just the code you posted, it would not run twice. It's somewhere else. Quote Link to comment https://forums.phpfreaks.com/topic/134207-firefox-running-a-query-twice/#findComment-698612 Share on other sites More sharing options...
PFMaBiSmAd Posted November 25, 2008 Share Posted November 25, 2008 http://www.phpfreaks.com/forums/index.php/topic,226301.msg1043443.html#msg1043443 Quote Link to comment https://forums.phpfreaks.com/topic/134207-firefox-running-a-query-twice/#findComment-698630 Share on other sites More sharing options...
br3nn4n Posted November 25, 2008 Author Share Posted November 25, 2008 Alrighit. I wonder if I could simply set the page encoding? Quote Link to comment https://forums.phpfreaks.com/topic/134207-firefox-running-a-query-twice/#findComment-699061 Share on other sites More sharing options...
DeanWhitehouse Posted November 25, 2008 Share Posted November 25, 2008 You use meta tags to set the page encoding or i think it can be done via header(); Quote Link to comment https://forums.phpfreaks.com/topic/134207-firefox-running-a-query-twice/#findComment-699067 Share on other sites More sharing options...
br3nn4n Posted November 26, 2008 Author Share Posted November 26, 2008 And that would most likely solve the problem? Quote Link to comment https://forums.phpfreaks.com/topic/134207-firefox-running-a-query-twice/#findComment-699212 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.