Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6834167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:04:40+00:00 2026-05-26T23:04:40+00:00

whenever I use the following code in PHP files , it gives me the

  • 0

whenever I use the following code in PHP files , it gives me the error (Error: XML or text declaration not at start of entity
Source)

<?xml version='1.0' encoding='utf-8'?>

I don’t know what could be the solution

please help

Thanks in advance

<?xml version='1.0' encoding='utf-8'?><rows><page>1</page><records>15</records><total>1</total><row id='18'><cell>18</cell><cell>2011-9-13</cell><cell>AL</cell><cell>2011-10-19</cell><cell>2011-10-21</cell><cell>3</cell><cell></cell><cell></cell><cell>Waiting for approval</cell><cell>mohan</cell><cell>Davinder Singh</cell></row><row id='17'><cell>17</cell><cell>2011-5-25</cell><cell>SL</cell><cell>2011-5-19</cell><cell>2011-5-19</cell><cell>1</cell><cell></cell><cell></cell><cell>Approved</cell><cell>Davinder</cell><cell>Kavita y</cell></row><row id='16'><cell>16</cell><cell>2011-5-25</cell><cell>SL</cell><cell>2011-5-24</cell><cell>2011-5-24</cell><cell>1</cell><cell></cell><cell></cell><cell>Approved</cell><cell></cell><cell>Kavita y</cell></row><row id='15'><cell>15</cell><cell>2011-5-26</cell><cell>AL</cell><cell>2011-7-08</cell><cell>2011-7-12</cell><cell>0</cell><cell></cell><cell></cell><cell>Disapproved</cell><cell></cell><cell>Kavita y</cell></row><row id='14'><cell>14</cell><cell>2011-5-25</cell><cell>AL</cell><cell>2011-6-30</cell><cell>2011-7-02</cell><cell>3</cell><cell></cell><cell></cell><cell>Approved</cell><cell></cell><cell>Kavita y</cell></row><row id='13'><cell>13</cell><cell>2011-9-14</cell><cell>CL</cell><cell>2011-6-15</cell><cell>2011-6-15</cell><cell>1</cell><cell></cell><cell></cell><cell>Waiting for approval</cell><cell></cell><cell>Kavita y</cell></row><row id='12'><cell>12</cell><cell>2011-5-25</cell><cell>CL</cell><cell>2011-6-10</cell><cell>2011-6-12</cell><cell>3</cell><cell></cell><cell></cell><cell>Waiting for approval</cell><cell></cell><cell>Kavita y</cell></row><row id='11'><cell>11</cell><cell>2011-5-25</cell><cell>SL</cell><cell>2011-5-20</cell><cell>2011-5-17</cell><cell>4</cell><cell></cell><cell></cell><cell>Waiting for approval</cell><cell></cell><cell>Kavita y</cell></row><row id='10'><cell>10</cell><cell>2011-5-25</cell><cell>CL</cell><cell>2011-6-03</cell><cell>2011-6-05</cell><cell>3</cell><cell></cell><cell></cell><cell>Waiting for approval</cell><cell>mohan</cell><cell>Davinder Singh</cell></row><row id='9'><cell>9</cell><cell>2011-5-26</cell><cell>SL</cell><cell>2011-5-18</cell><cell>2011-5-22</cell><cell>5</cell><cell></cell><cell></cell><cell>Waiting for approval</cell><cell>mohan</cell><cell>Davinder Singh</cell></row><row id='8'><cell>8</cell><cell>2011-5-24</cell><cell>AL</cell><cell>2011-5-20</cell><cell>2011-5-20</cell><cell>0</cell><cell></cell><cell></cell><cell>Disapproved</cell><cell>mohan</cell><cell>Davinder Singh</cell></row><row id='7'><cell>7</cell><cell>2011-5-24</cell><cell>CL</cell><cell>2011-5-20</cell><cell>2011-5-20</cell><cell>1</cell><cell></cell><cell></cell><cell>Waiting for approval</cell><cell>mohan</cell><cell>Davinder Singh</cell></row><row id='4'><cell>4</cell><cell>2011-9-14</cell><cell>SL</cell><cell>2011-5-20</cell><cell>2011-5-20</cell><cell>1</cell><cell></cell><cell></cell><cell>Waiting for approval</cell><cell>mohan</cell><cell>Davinder Singh</cell></row><row id='3'><cell>3</cell><cell>2011-5-24</cell><cell>SL</cell><cell>2011-5-20</cell><cell>2011-5-20</cell><cell>1</cell><cell></cell><cell></cell><cell>Waiting for approval</cell><cell>mohan</cell><cell>Davinder Singh</cell></row><row id='1'><cell>1</cell><cell>2011-5-24</cell><cell>SL</cell><cell>2011-5-20</cell><cell>2011-5-22</cell><cell>0</cell><cell>dd</cell><cell>remarks</cell><cell>Disapproved</cell><cell>mohan</cell><cell>Davinder Singh</cell></row></rows>

and the php code

header("Content-type: text/xml;charset=utf-8");

$s = "<?xml version='1.0' encoding='utf-8'?>";
$s .=  "<rows>";
$s .= "<page>".$page."</page>";
$s .= "<records>".$count."</records>";

$s .= "<total>".$total_pages."</total>";


// be sure to put text data in CDATA
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {


    $s .= "<row id='". $row['fld_id']."'>";

    $s .= "<cell>". $row['fld_id']."</cell>";   
    $s .= "<cell><![CDATA[". getDepartmentName($row['deptSr'])."]]></cell>";
    $s .= "<cell>". $row['email']."</cell>";
    $s .= "<cell>". $row['fname']."</cell>";
    $s .= "<cell>". $row['lname']."</cell>";
    $s .= "<cell>". $row['password']."</cell>";

    $s .= "<cell>". listlevel($row['level'])."</cell>"; 
    $s .= "<cell>". date('Y-m-d G:i:s', $row['date_create'])."</cell>";
    $s .= "<cell>". date('Y-m-d G:i:s', $row['last_login'])."</cell>";  
    $s .= "<cell>". $row['ip_addr']."</cell>";
    $s .= "<cell>". $row['dob']."</cell>";  
    $s .= "<cell>". $row['street']."</cell>";       
    $s .= "<cell>". $row['phone_mob']."</cell>";        
    $s .= "<cell>". $row['phone_home']."</cell>";   
    $s .= "<cell>". liststatus($row['fld_enabled'])."</cell>";  

    $s .= "</row>";
}
$s .= "</rows>"; 

echo $s;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:04:41+00:00Added an answer on May 26, 2026 at 11:04 pm

    XML or text declaration not at start of entity indicates that the prolog isn’t the first line in the output. Most likely, a blank line is somehow finding its way into your output. This error isn’t unique to WordPress; however, as I mentioned in my comment, I did a search for the error message on Google and WordPress comes up in a lot of the results. If you’re not using WordPress, kindly disregard the remainder of this answer.

    Disclaimer: I know nothing about WordPress so I’m reluctant to answer in that capacity; however, since there are no other answers as of this writing, I’ll simply show you what I’ve found on the subject.

    • WordPress leading whitespace fix seems to help some people with the error you specified.

    • Additional suggestions are available here.

    • How to fix: XML Parsing Error: XML or text declaration not at start of entity deals with white space before the prolog. The comment suggests using ob_start() and ob_end_clean().

    If you are using WordPress, you may attract better answers by adding the WordPress tag to your question. There’s no guarantee, but it could draw the attention of those more knowledgeable than myself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Whenever I use the following code, the webserver (running IIS 7) refuses to send
Whenever I use the Eclipse source code formatter / beautifier (via the menu item
For some reason the following code does not work as expected when in IE
I use the following MSDN code on my master page to detect if the
Why whenever I compile and run the following code in Visual Studio 2008: double
What is the problem with the following code as root user: chpwd.pl #!/usr/bin/perl use
I use the following code to open external pages within a div on the
Whenever I reformat html source code in Visual Studio with Ctrl-K, Ctrl-D it formats
I get the above error whenever I try and use ActionLink ? I've only
In my controller I have the following code to generate a Json response whenever

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.