1) According to fors it should be 64, because it's 0-7... it should be $a=1 / $b=1
2) Query inside cycle = ugh... you have "INSERT INTO table (COLUMNS) VALUES (VALUES1), (VALUES2), (VALUES3)..." syntax, just concatenate the string and send 1 query instead of 49
3) Seems default for Type is 0 and you're inserting "wood", I'd say the Type column is set to be of a numeric type of some sort...
4) Looking at the list.... I would guess you have some sort of unique constrain set up on x+y... seems like it's working both ways which is weird, but I dunno what to do with it right now
which reminds me of:
5) No detection whether query was successful or not
BTW I would suggest to have a consistent caps style in column names (Type, Cont, X, Y versus id, player, village)