Results 1 to 3 of 3
  1. #1
    Newbie
    Join Date
    September 6th, 2010
    Posts
    2
    php/html can't get empty zone gone
    I have a web page that loads part of a map from a database, then prints the images on the screen. it uses Ajax to load the part of the map it wants. it works fine, but there is a small spacing between the rows of the map that just won't disappear whatever i try, please help. I've tried firefox, IE and chrome but they all have the problem.

    main page
    Code:
    <html>
    <head>
    <title>Map</title>
    <style type="text/css"> 
    	body {
    		background-color:#004477;
    	}
    	td {
    		padding:0px;
    	}
    	table {
    		border-spacing:0px;
    	}
    </style>
    <script type="text/javascript">
    	function loadmap(x,y,width,height){
    		if(window.XMLHttpRequest)
    		action = new XMLHttpRequest();
    		else
    		action = new ActiveXObject("Microsoft.XMLHTTP");	
    		action.onreadystatechange=function(){
    			if (action.readyState==4)
    			document.getElementById("mapdiv").innerHTML = action.responseText;			
    		}				
    		action.open("GET","loadmappart.php?startx="+x+"&starty="+y+"&mapsizex="+width+"&mapsizey="+height,true);
    		action.send();		
    		document.getElementById("mapmover").style.left = 20+40*width+"px";
    	}
    </script>
    </head>
    <body onload="loadmap(0,0,20,20)">
    <div id="mapdiv">
    </div>
    
    </body>
    </html>
    loaded page
    Code:
    <html>
    <head>
    <title>Mapload</title>
    <style type="text/css"> 
    	body {
    		background-color:#004477;
    	}
    	td {
    		padding:0px;
    	}
    	table {
    		border-spacing:0px;
    	}
    </style>
    </head>
    <?php
    	mysql_connect("localhost","root","root") or die(mysql_error());
    	mysql_select_db("GameData") or die(mysql_error);
    	$map = "<table cell>";
    	$startx = round($startx);
    	$starty = round($starty);
    	$mapsizex = round($mapsizex);
    	$mapsizey = round($mapsizey);
    	if($startx > 200-$mapsizex)
    	$startx = 200-$mapsizex;
    	if($startx < 0)
    	$startx = 0;
    	if($starty > 200-$mapsizey)
    	$starty = 200-$mapsizey;
    	if($starty < 0)
    	$starty = 0;
    	$image = array();
    	$image[0] = "images/grasstile.png";
    	$image[1] = "images/woodtile.png";
    	$image[2] = "images/metaltile.png";
    	$image[3] = "images/claytile.png";
    	for($a=$starty;$a<$starty+$mapsizey;$a++){
    		$num = 200*$a;
    		$end = 200*$a+$mapsizex;
    		$inputdata = mysql_query("SELECT * FROM map
    		WHERE id>='$num' AND id<'$end'") or die(mysql_error());
    		$map = $map."<tr>";
    		for($b=$startx;$b<$startx+$mapsizex;$b++){	
    			$v = mysql_fetch_array($inputdata);
    			$map = $map."<td><img src=\"".$image[$v['type']]."\"></td>";
    		}
    		$map = $map."</tr>";
    	}
    	$map = $map."</table>";
    	echo $map;
    ?>
    </body>
    </html>
    Last edited by samanesh; September 6th, 2010 at 08:55 AM.

  2. #2
    ABW Ambassador 2busy's Avatar
    Join Date
    January 17th, 2005
    Location
    Tropical Mountaintop
    Posts
    5,636
    any chance that the images are not borderless - have their own margin?

  3. #3
    Newbie
    Join Date
    September 6th, 2010
    Posts
    2
    no, the problem is only there on the main page, if i load the other page directly the problem isn't there.

  4. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Php - Html
    By betherg in forum Programming / Datafeeds / Tools
    Replies: 7
    Last Post: January 7th, 2013, 10:59 AM
  2. HTML or PHP for SEO ?
    By mopek in forum Programming / Datafeeds / Tools
    Replies: 8
    Last Post: March 17th, 2009, 08:51 PM
  3. Who to go to for html , php and css?
    By Mitty in forum Midnight Cafe'
    Replies: 3
    Last Post: May 21st, 2007, 12:31 PM
  4. Empty A MySQL Database Using PHP
    By AddHandler in forum Programming / Datafeeds / Tools
    Replies: 2
    Last Post: March 25th, 2006, 04:29 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •