Reply to Problem When Generating HTML

Your name:

Reply:


Posted by dawnerd on 05/02/07 22:11

I am having troubles with my script. It is supposed to generate a
"map" from a serialized array stored in a database. However, it is not
generating any html. I know the data is being retrieved from the
database and being unserialized properly as I've tested that. It seems
to not go through the loop.

/**
* function drawMap( $startx, $starty, $p1, $p2, $p3 )
* Generates html for output.
*/
function drawMap( $startx, $starty, $p1, $p2, $p3 )
{
$sql = "SELECT * FROM `cp_citymap` WHERE `p1` = '$p1' AND `p2` =
'$p2' AND `p3` = '$p3'";
$query = $this->database->query( $sql );
$num = $this->database->count_rows( $query );

if( $num != 1 )
{
$this->error = "Could not find City Map data.";
return false;
}

$row = $this->database->get_row( $query );

$mapArray = unserialize( $row['blocks'] );

$x = $startx;
$y = $starty;
$maxx = $x - 11;
$maxy = $y + 10;

while( $x < $maxx )
{
$this->outputHTML .= "<span class=\"cityMapBlock\"><a href=\"#\"
title=\"" . $mapArray[$x][$y]['type'] . "\">" . $mapArray[$x][$y]
['type'] . "</a></span>";

if( $mapArray[$x][$y] == $maxy )
{
$this->outputHTML .= "</br>";
$y = $maxy - 10;
$x--;
}
}

return true;
}

Any help at all would be appreciated greatly, and I'll give you a
million internets.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация