Ok, so basically, I have this code in a 3.php include. The code works fine when placed on another include or on the page which does the include (index.php) UNLESS the 3.php is included. Then it increments between 1 and 3... So I tried to remove the echo on 3.php (the only thing beside the MySQL stuff) Miracle, it increments correctly! I replace the echo and poof, issue is back again. Could anybody tell me what the hell is going on with this? Increments correctly (+1): <?php $dbcon = mysql_connect("localhost","username","password"); mysql_select_db("database", $dbcon); $psel = mysql_query("SELECT p FROM stats WHERE g='value'"); $pres = mysql_fetch_array($psel); $p = $pres['p'] + 1; mysql_query("UPDATE stats SET p = $p WHERE g='value'"); echo $p; ?> Code (markup): Increment incorrectly (+ 2 or 3): <? $dbcon = mysql_connect("localhost","username","password"); mysql_select_db("database", $dbcon); $psel = mysql_query("SELECT p FROM stats WHERE g='value'"); $pres = mysql_fetch_array($psel); $p = $pres['p'] + 1; mysql_query("UPDATE stats SET p = $p WHERE g='value'"); echo $p; echo' <div class="gamewrap"> <div class="game" style="width:',$width+6,'px;"> <div class="gameinner"> <object data="http://arcade.namworld.com/games/',$page,'.swf" codetype="application/x-shockwave-flash" width="',$width,'" height="',$height,'"> <param name="movie" value="http://arcade.namworld.com/games/',$page,'.swf" /> <param name="quality" value="high" /> ',$warning,' </object> </div> </div> </div> <div class="infobox"> <div class="controls">',$controls,'</div> <div class="instructions"><center><b>',$title,'</b><br/></center>',$instructions,'</div> <div class="adbox"> <script type="text/javascript">google_ad_client = "pub-1898092816879697"; /* Namworld Arcade 300 x 250 */ google_ad_slot = "0335876732";google_ad_width = 300;google_ad_height = 250;</script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script> </div> </div> '; ?> Code (markup): Seems that long echo is what cause the problem. But that makes absolutly no sense to me looking at that echo's content. And the fact that it is placed AFTER the damned MySQL update. I don't understand how a simple echo can mess a MySQL update that was done BEFORE that echo. Cause if I remove that echo, it increments correctly. But that echo is AFTER. That's puzzling, It's my first database creation. Read, learned and coded everything tonight. So it might be that I don't fully understand databases yet (obviously). But an echo placed after the query which can MESS with that query kind of bypass any kind of logic I can think of. I'm basically just creating a game plays counter for my arcade website. It's fun to create cause it's easy to learn PHP because features for a flash game portal are kind of basic functions. But that is just one of the strangest issue I encountered so far while creating it.
I've played a bit with the code, and it seems it happens in Firefox, but not in IE. And it stop happening in Firefox as soon as no flash file is displayed on the page. So the issue would be more about Firefox. Anyone have done incrementation of a value on a page with a flash object which Firefox doesn't mess up?