Passing parameters to phpgenxml

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Im using php to generate xml from a database. This in turn generates
markers (accommodation and restaurants) on a googlemap with the
database data. At the moment I have separate phpgenxml files to
generate the different types i.e accommodation and restaurants. I want
to have the one page and display different data when links are clicked
i.e accommodation for accommodation etc. I've no experience with
passing parameters in php. I presume that its just a different query
string sent to the database depending on which link is pressed. Here's
my code for the called phpgen_xml:



function parseToXML($htmlStr)






return $xmlStr;


// Opens a connection to a mySQL server


if (!$connection) {

 echo('Not connected : ' . mysql_error());


// Set the active mySQL database

$db_selected = mysql_select_db($database, $connection);

if (!$db_selected) {

  die ('Can't use db : ' . mysql_error());


// Select all the rows in the markers table

$query = "SELECT * FROM markers WHERE 1";

$result = mysql_query($query);

if (!$result) {

  die('Invalid query: ' . mysql_error());


header("Content-type: text/xml");

// Start XML file, echo parent node

echo '<markers>';

// Iterate through the rows, printing XML nodes for each

while ($row = @mysql_fetch_assoc($result)){


  echo '<marker ';

  echo 'name="' . parseToXML($row['name']) . '" ';

  echo 'add1="' . parseToXML($row['add1']) . '" ';

  echo 'add2="' . parseToXML($row['add2']) . '" ';

  echo 'add3="' . parseToXML($row['add3']) . '" ';

  echo 'type="' . $row['type'] . '" ';

  echo 'long="' . $row['long'] . '" ';

  echo 'lat="' . $row['lat'] . '" ';

  echo '/>';


// End XML file

echo '</markers>';


If anyone could help me soon that would be great. I have to hand this
project in in two weeks. Thank you in advance.

Site Timeline