first it checks if the dimensions exist, and if they do, the num_users field is updated by +1.
HOWEVER
when using google chrome (not firefox, ie/7/8/9), it's incrementing by 2. every time.
so my question is: is it possible to prevent this from happening twice? Maybe a mysql setting, or some fancy code?
Here's my simple script, minus the checker, etc. it just updates values.
Code: Select all
<?php
require_once('adm/inc/functions.php');
require_once('adm/inc/config.php');
sql_connect();
$width = 1280;//mysql_real_escape_string($_POST['width']);
$height = 960;//mysql_real_escape_string($_POST['height']);
$screen_width = 1200;//mysql_real_escape_string($_POST['screen_width']);
$screen_height = 716;//mysql_real_escape_string($_POST['screen_height']);
$quer = "UPDATE `$db`.data SET `num_users` = `num_users` + 1 WHERE `id` = $id";
if($result = mysql_query($quer)){
echo "Updated.";
}
else{
die("Error: ".mysql_error());
}
?>