I'm trying to get a demo of XMLHTTPRequest off the ground for a project I'm working on. Using some simple sample code, Firefox tells me the following:
XML Parsing Error: xml processing instruction not at start of external entity
Here's the PHP/XML:
<?
header('Content-Type: text/xml');
function nameInUse($thename)
{
$q = "SELECT id, username FROM users WHERE username='$thename'";
if(mysql_num_rows(mysql_query($q)))
return 1;
else
return 0;
}
?>
<!-- XML BELOW -->
<?
echo '<?xml version="1.0"?>';
?>
<response>
<method>verifyDesiredUsername</method>
<result><? echo nameInUse($_GET['n']); ?></result>
</response>
For the life of me I cannot figure out what is wrong. The above code is supplied as part of the tutorial (essentially.. tweaked it a bit) and others have verified that it works. However, I'm still at a loss. :/ Any help?