getting error as
This page contains the following errors:

error on line 2 at column 1: Extra content at the end of the document
Below is a rendering of the page up to the first error.

for following code. please help me to resolve this

header("Content-Type: text/xml"); 
$xmlBody = '<?xml version="1.0" encoding="ISO-8859-1"?>';
$xmlBody .= "<XML>";

 mysql_connect("localhost","root","") or die("sorry");

$sql = mysql_query("SELECT * FROM payment ORDER BY paydate DESC LIMIT 0, 4");
while($row = mysql_fetch_array($sql)){

    $payid = $row["payid"]; 
    $paystatus = $row["status"];  
    $payamount = $row["payamount"];  
    $cnum = $row["cnum"];  
     $xmlBody .= '
    <payid>' . $payid . '</payid> 
    <paystatus>' . $paystatus . '</paystatus>
    <payamount>' . $payamount . '</payamount>
    <cnum>' . $cnum . '</cnum>
} // End while loop
$xmlBody .= "</XML>";
echo $xmlBody; 

Recommended Answers

All 2 Replies

Member Avatar

You may have a zero width character at the end of your file? Copy the text and place into a clean file and save as UTF-8 without BOM


Thank you ! will try

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.