Hi,

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

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

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

$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 .= '
<payment> 
    <payid>' . $payid . '</payid> 
    <paystatus>' . $paystatus . '</paystatus>
    <payamount>' . $payamount . '</payamount>
    <cnum>' . $cnum . '</cnum>
</payment>';
} // End while loop
mysql_close(); 
$xmlBody .= "</XML>";
echo $xmlBody; 
?>
Member Avatar for diafol

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

Maybe?

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, networking, learning, and sharing knowledge.