Here is the relevant line:
echo '<markers>';
My understanding is that this should use the literal string included in the single quotes without parsing. Yet, I get no output from this line.
If replace that line with a string without ">" or "<" characters, it shows up fine. For example, the following works fine:
echo 'test';
Also, when there is no content in between the brackets, the echo also works, as in:
echo '<>';
Yet, if I put anything at all between them, I get no output at all from this line. I've tried using escape characters as well, it doesn't solve the problem.
I am using godaddy as my host, I don't know if it's relevant to this, but I've heard there can be weird problems with them.
Thanks!
I've posted the entire code below, with password and database name redacted of course, for those who are interested. I am in the middle of development, so that's why it's a bit disorganized.
<?php
function parseToXML($htmlStr)
{
$xmlStr=str_replace('<','<',$htmlStr);
$xmlStr=str_replace('>','>',$xmlStr);
$xmlStr=str_replace('"','"',$xmlStr);
$xmlStr=str_replace("'",''',$xmlStr);
$xmlStr=str_replace("&",'&',$xmlStr);
return $xmlStr;
}
$con = mysql_connect("databaseIPHere","databaseNameHere","passwordHere");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
// Execute query
mysql_query($sql,$con);
mysql_select_db("databaseNameHere", $con);
$result = mysql_query("SELECT `Stores`.`name` FROM Stores
WHERE (`Stores`.`name` LIKE '%pizza%')");
// header("Content-type: text/xml");
// Start XML file, echo parent node
echo '<markers>';
//echo 'testing 1 2 3';
// Iterate through the rows, printing XML nodes for each
while ($row = mysql_fetch_array($result)){
// ADD TO XML DOCUMENT NODE
// echo "<td>" . $row['name'] . "</td>";
// echo "<marker ";
// echo 'name="' . parseToXML($row['name']) . '" ';
// echo 'address="' . parseToXML($row['address']) . '" ';
echo 'name="' . $row['name'] . '" ';
// echo address="' . $row['address'] . '";
// echo lat="' . $row['lat'] . '" ';
// echo lng="' . $row['lng'] . '" ';
// echo type="' . $row['type'] . '" ';
// echo />';
}
// End XML file
echo '</markers>';
mysql_close($con);
?>
This post has been edited by tremtie: 19 January 2009 - 03:38 AM

New Topic/Question
Reply




MultiQuote









|