<?php
function do_clash(){
$setting = $_POST['setting'];
if($setting == 0){
echo "display";
}else{
$sql1= "SELECT * FROM table1 WHERE ID = '".$_SESSION["username"]."'";
$sql_result1 = mssql_query($sql1);
$row1 = mssql_fetch_row($sql_result1);
if ($row1[0] == ""){
$sql = "INSERT INTO test (valus1,valus2,valus3) VALUES ('".$_SESSION["username"]."','0','0')";
mssql_query($sql);
}
mssql_query("UPDATE table2 SET valus2 = valus2+$setting WHERE ID = '".$_SESSION["username"]."'");
mssql_query("UPDATE table1 SET setting = 0 WHERE ID = '".$_SESSION["username"]."'");
echo "<script>navigate('index.php')</script>";
}
?>