# Dynamic updating Map

**URL:** <https://forum.kirupa.com/t/dynamic-updating-map/239724>\
**Category:** programming\
**Created:** [September 25, 2007, 1:07pm UTC](https://forum.kirupa.com/t/dynamic-updating-map/239724 "2007-09-25T13:07:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![talonofdarkness](https://avatars.discourse-cdn.com/v4/letter/t/8e8cbc/32.png) [@talonofdarkness](https://forum.kirupa.com/u/talonofdarkness)\
**Post date:** [September 25, 2007, 1:07pm UTC](https://forum.kirupa.com/t/dynamic-updating-map/239724/1 "2007-09-25T13:07:08Z")

</div>

Hey all, i would like some help with an idea i have for my game i am making.

The map is a large 100x100 square grid, now this is to big to display all at once, so i am wondering how to affectively reduce the size so u can only see say 10 squares at a time.

So say i have a top link which lets u go up in the map

```php
if($y-5 > 0) {
    $newY = $y-5;
    $top_nav = "<a href='map.php?x=$x&y=$newY'>Up</a>";
} else $top_nav = "Up";

```

Then i have a left link which lets u go left in the map

```php
if($x-5 > 0) {
    $newX = $x-5;
    $left_nav = "<a href='map.php?x=$newX&y=$y'>Left</a>";
} else $left_nav = "Left";

```

Then i have a right link which lets u go right in the map

```php
if($x+5 < 100) {
    $newX = $x+5;
    $right_nav = "<a href='map.php?x=$newX&y=$y'>Right</a>";
} else $right_nav = "Right";

```

Then i have a bottom link which lets u go down in the map

```php
if($y+5 < 100) {
    $newY = $y+5;
    $bot_nav = "<a href='map.php?x=$x&y=$newY'>Bottom</a>";
} else $bot_nav = "Bottom";

```

Now this works, what i am wondering is hwo to display the images?! They are all stored in a mysql database.

the database table is like so

```auto
world_id int(11) NOT NULL auto_increment,
  x int(11) NOT NULL,
  y int(11) NOT NULL,
  village_id int(11) NOT NULL,
  image varchar(255) collate latin1_general_ci NOT NULL,
  PRIMARY KEY (world_id)

```

I was thinking having a for loop to display them but i am not entirely sure. Any help would be much appreciated.
