Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-27-2011, 08:55 PM   PM User | #1
HCProfessionals
New to the CF scene

 
Join Date: Mar 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
HCProfessionals is an unknown quantity at this point
Exclamation Map Grid help

I tried adding the while loop in the function below, but when i view the page, it just sits there and times out.

PHP Code:
//Function to display the map.
function DisplayGrid($grid_x,$grid_y) {
    global 
$x$y$user_location$users_map;
    
        
$bgimg 'grass.gif';
        
$building '';

        
//Display current user location on the displayable grid if exists.
        
if ($grid_x == $user_location['x'] &&  $grid_y == $user_location['y']) {
             
$building '<img src="images/map/building.gif" alt="" border="0" /><br />';
             
$user_map_name '<br /><a href="player_profile.php?id='.$user_location['uID'].'" target="_blank"><u><b>'.$user_location['uLogin'].'</b></u></a><br />';
        }

        
//Fetch all player locations within the displayable grid.
        
while($users_map mysql_fetch_array(mysql_query("SELECT * FROM map LEFT JOIN users ON map.uID=users.uID WHERE map.x=$grid_x AND map.y=$grid_y"))){
            
$building '<img src="images/map/building.gif" alt="" border="0" /><br />';
            
$user_map_name '<br /><a href="player_profile.php?id='.$users_map['uID'].'" target="_blank"><u><b>'.$users_map['uLogin'].'</b></u></a><br />';
        }
    
    echo 
"<td width=\"75\" height=\"75\" style=\"background-image: url('images/map/$bgimg');background-repeat: repeat;\" align=center valign=center onclick=\"window.location.href='map.php?xcord=$grid_x&ycord=$grid_y'\">$building $user_map_name</td>";

HCProfessionals is offline   Reply With Quote
Old 03-27-2011, 09:11 PM   PM User | #2
HCProfessionals
New to the CF scene

 
Join Date: Mar 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
HCProfessionals is an unknown quantity at this point
Got it
HCProfessionals is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:17 PM.


Advertisement
Log in to turn off these ads.