Multi Query Map
Posted: Sat Jan 09, 2010 10:48 pm
Good Evening Ladies and Gentlemen.
I have a question and am seeking some assistance if possible. I have 2 tables in my database one called map the other is users. What I'm trying to do is generate a map that is 15x15 that has the avatar associated with the user appear in the center. I'm confused on how to get the avatar in the middle of the table along with pulling from 2 tables. I need the x,y coords and the avatar from the users table, and I need the x,y coords and the tile (image) from the map table.
Here is what I have so far. Which generates the 15x15 map.
I have a question and am seeking some assistance if possible. I have 2 tables in my database one called map the other is users. What I'm trying to do is generate a map that is 15x15 that has the avatar associated with the user appear in the center. I'm confused on how to get the avatar in the middle of the table along with pulling from 2 tables. I need the x,y coords and the avatar from the users table, and I need the x,y coords and the tile (image) from the map table.
Here is what I have so far. Which generates the 15x15 map.
Code: Select all
<?php
include ("database.php");
$result = mysql_query("SELECT xloc, yloc FROM users where user='fallenangel820'");
$xloc = $result['xloc'];
$yloc = $result['yloc'];
$xstart = $xloc - 3;
$ystart = $yloc - 3;
echo "<table cellpadding=0 cellspacing=0>";
for ($x=$xstart; $x<=$xstart + 14; $x++)
{
echo "<tr>";
for ($y=$ystart; $y<=$ystart + 14; $y++)
{
echo "<td><img src=\"/images/map/center.gif\"></td>";
}
echo "</tr><br />";
}
echo "</table>";
?>