anchor.diff:  
   		//states_total
   
  -		 sqlpre = "SELECT * FROM states_total WHERE state = " + state;
  +		 sqlpre = "SELECT * FROM states_total WHERE state = '" + state +"'";
   		 rs = stmt.executeQuery(sqlpre);
   
   		 if (rs.isBeforeFirst())
  -		 	sql = "UPDATE states_total SET total = total + " + grandtotal + " WHERE  state = " + state;
  +		 	sql = "UPDATE states_total SET total = total + " + grandtotal + " WHERE  state = '" + state +"'";
   		 else
  -		 	sql = "INSERT INTO states_total VALUES (" + state + ", " + grandtotal + ")";
  +		 	sql = "INSERT INTO states_total VALUES ('" + state + "', " + grandtotal + ")";
   
   			stmt.executeUpdate(sql);
   		
  
positive.code: 			 //users_categories_total
  
  
  			sqlpre = "SELECT * FROM users_categories_total WHERE uid = " + uid;
  			rs = stmt.executeQuery(sqlpre);
  
  			if (rs.isBeforeFirst())
  
negative.code: 			
  			//users_products_total
  
  			sqlpre =  "SELECT * FROM users_products_total WHERE uid = " + uid + "AND pid = " + pid;
  			rs = stmt.executeQuery(sqlpre);
  			
  			if (rs.isBeforeFirst())
  				sql = "UPDATE users_products_total SET total = total + " + total + "WHERE uid = " + uid + "AND pid = " + pid;
  			else
  