Think of this as a map appication I am writing... I have 2 tables in my database (tiles and tile_positions) An example of what the fields look like: TILES ============ tileID: 1 tileIMG: something.jpg ============ TILE_POSITIONS ============ ID: 1 tileID: 1 xpos: 0 ypos: 0 ============ Code (markup): Here is how I would retrieve the images and positions for the tiles. while($tile = mysql_fetch_array($posquery)){ $imgquery = mysql_query("SELECT * FROM tiles WHERE tileID='$tile[tileID]'"); $img = mysql_fetch_array($iquery); echo '<img src="'.$img[img].'" />; } PHP: Is doing a seperate mysql_query for each tile going to be overkill for mysql if there are 50-ish tiles with different ID's for each page? If yes how would you recommend doing it?
hello, try this query: SELECT tiles.tileID, tiles.tileIMG, tile_positions.tileID, tile_positions.xpos, tile_positions.ypos FROM tiles, tile_positions WHERE tiles.tileID = tile_positions.tileID; Code (markup): Let me know if it works or not.