Sounds like something really interesting you're working on. I've done a fair bit of work using Construct with databases and PHP but I've not quite figured the best way to do what you're needing.
Would it be possible to only have a database entry for squares that contain something? Then use a script to get any entry within the x/y range specified whereby a certain field is not blank?
This would bring down the number of results returned by the script and be more efficient - but if you need info from EVERY square then it's no good.
Alternatively, run a script several times, once looking for each resource or troop type? That would also limit the number of results significantly and you could still get every square in the range - again this would also be helped if there are empty squares as it won't be retrieving them.