Error Type: LoadXML Description: Incorrect XML

I am in the middle of a server hardware upgrade that my websites are hosted on. The source server uses MySQL 5.0, PHP 5.2 and Apache 1.3. The new server is running MySQL 5.6, PHP 5.5 and Apache 2.4. Naturally, I started testing the websites on the new server before migrating the DNS records to point to the new server to ensure the site won’t break. In the testing process, I have consistently come across the following error on any page that displays data pulled from MySQL:

 Error Type: LoadXML Description: Incorrect XML

The page will load, throw the alert and after acknowledging it, will display the page normally. It just won’t display the data from the table.

Note: I am using a temporary URL to access the site on the new server to test it.

Any suggestions would be appreciated as I am new to PHP, XML and MySQL.

Thank you!

Extra Info:

Code Displaying actual Page with Error:

GET method code for page:

//print tree XML based on parent_id (function calls itself to go through the nested levels)
function getRowsFromDB($parent_id){
//get tree level from database taking parent id as incomming argument
$sql = "SELECT DISTINCT invoices.id, invoices.tracking, invoices.shippeddate, invoices.partialship, invoices.partialshipqty, invoices.stagestatus, invoices.shipnotes, invoices.tracking as “trk”, invoices.ponumber as “PO Number”, invoices.carrier, clients.company FROM clients INNER JOIN invoices ON ( clients.id = invoices.clientid ) WHERE invoices.stagestatus = “Shipping: Needs BOL” ";

	//echo $sql;
	$res = mysql_query ($sql);
	if($res){
		while($row=mysql_fetch_array($res)){
			//create xml tag for grid row
			print("<row id=' ".$row['id']." '>");
				//print("<cell><![CDATA["."<a href='workorders_addedit.php?id=".$row['id']."'target="."'_blank' >SG".$row['id']."</a>"."]]></cell>");
				print("<cell><![CDATA["."<b>SG".$row['id']."</b>"."]]></cell>");
			//	print("<cell><![CDATA["."<b>".$row['Required Date']."<b>"."]]></cell>");
				print("<cell><![CDATA[".$row['company']."]]></cell>");
				print("<cell><![CDATA[".$row['PO Number']."]]></cell>");
				print("<cell><![CDATA[".$row['carrier']."]]></cell>");
				print("<cell><![CDATA[".$row['tracking']."]]></cell>");
				print("<cell><![CDATA[".$row['shippeddate']."]]></cell>");
				print("<cell><![CDATA[".$row['shipnotes']."]]></cell>");

						
				print("<cell><![CDATA[".$row['stagestatus']."]]></cell>");
							if ($row['carrier'] != NULL && $row['trk']==NULL)
					{
					print("<cell><![CDATA["."<img src='shiperror.png' border='0'/><sup>TR DATA INCOMPLETE</sup></a> "."]]></cell>");
					}

					
					elseif ($row['carrier'] == "FedEx")
					{
					print("<cell><![CDATA["."<a href='"."http://www.fedex.com/Tracking?ascend_header=1&clienttype=dotcom&cntry_code=us&language=english&tracknumbers=".$row['trk']."'target="."'_blank'><div class='greenbg'><img src='ship1.png' border='0' /><sup>TRACK IT!</sup></div></a> "."]]></cell>");
					}
					elseif ($row['carrier'] == "Yellow/YRC")
					{
					print("<cell><![CDATA["."<a href='"."http://my.yrc.com/dynamic/national/servlet?CONTROLLER=com.rdwy.ec.rextracking.http.controller.ProcessPublicTrackingController&PRONumber=".$row['trk']."'target="."'_blank'><div class='greenbg'><img src='ship1.png' border='0' /><sup>TRACK IT!</sup></div></a> "."]]></cell>");
					}
					
					elseif ($row['carrier'] == "ADuie Pyle")
					{
					print("<cell><![CDATA["."<a href='"."http://www.aduiepyle.com/publicdocs/LTLTracking.aspx?Pro=".$row['trk']."'target="."'_blank'><div class='greenbg'><img src='ship1.png' border='0' /><sup>TRACK IT!</sup></div></a> "."]]></cell>");
					}		
									
					elseif ($row['carrier'] == "Conway")
					{
					print("<cell><![CDATA["."<a href='"."https://www.con-way.com/webapp/manifestrpts_p_app/Tracking/TrackingRS.jsp?PRO=".$row['trk']."'target="."'_blank'><div class='greenbg'><img src='ship1.png' border='0' /><sup>TRACK IT!</sup></div></a> "."]]></cell>");
					}
					
					elseif ($row['carrier'] == "Estes")
					{
					print("<cell><![CDATA["."<a href='"."http://www.estes-express.com/cgi-dta/edn419.mbr/output?search_type=F&random_number=&hash_value=&search_criteria=".$row['trk']."'target="."'_blank'><div class='greenbg'><img src='ship1.png' border='0' /><sup>TRACK IT!</sup></div></a> "."]]></cell>");
					}
					
					elseif ($row['carrier'] == "UPS")
					{
					print("<cell><![CDATA["."<a href='"."http://wwwapps.ups.com/WebTracking/processRequest?HTMLVersion=5.0&Requester=NES&AgreeToTermsAndConditions=yes&loc=en_US&tracknum=".$row['trk']."'target="."'_blank'><div class='greenbg'><img src='ship1.png' border='0' /><sup>TRACK IT!</sup></div></a> "."]]></cell>");
					}
					elseif ($row['carrier'] == "DHL")
					{
					print("<cell><![CDATA["."<a href='"."http://track.dhl-usa.com/TrackByNbr.asp?ShipmentNumber=".$row['trk']."'target="."'_blank'><div class='greenbg'><img src='ship1.png' border='0' /><sup>TRACK IT!</sup></div></a> "."]]></cell>");
					}
					
					elseif ($row['trk']==NULL)
					{
					print("<cell><![CDATA["."<a href='"."http://www.lticontrol.com/APTS_BETA/modules/bms/workorders_addedit.php?id=".$row['id']."'target="."'_blank'><img src='shiperror.png' border='0'/><sup>TR# BLANK</sup></a> "."]]></cell>");
					}
					
				else
				
					{
					print("<cell><![CDATA["."<div class='orangebg'><img src='shiperror.png' border='0'/><sup>IMPROPER FORMAT</sup></div></a> "."]]></cell>");
					}
				
				
					{
					print("<cell><![CDATA[Tracking Data Not Loaded]]></cell>");
					//print("<cell><![CDATA["."<a href='".$row['trk']."'target="."'_blank'><img src='ship.png' border='0' /></a> "."]]></cell>");
					}
	//			print("<cell><![CDATA[".$row['loc']."]]></cell>");
	//			print("<cell><![CDATA["."<b>".ceil ($row['Total SqFt'])."</b>"."]]></cell>");
	//			print("<cell><![CDATA["."<b>".$row['quantity']."<b>"."]]></cell>");
	//				print("<cell><![CDATA[".$row['CR1']."]]></cell>");
	//				print("<cell><![CDATA[".$row['CR2']."]]></cell>");
	//					print("<cell><![CDATA[".$row['Notes']."]]></cell>");
					//	print("<cell><![CDATA["."<a href='".$row['trk']."'target="."'_blank'><img src='ship.png' border='0' /></a> "."]]></cell>");
					
			print("</row>");
			
		}
	}else{
		echo mysql_errno().": ".mysql_error()." at ".__LINE__." line in ".__FILE__." file<br>";
	}
}

//XML HEADER

//include XML Header (as response will be in xml format)
if ( stristr($_SERVER[“HTTP_ACCEPT”],“text/xml”) ) {
header(“Content-type: application/xhtml+xml”); } else {
header(“Content-type: text/xml”);
}
echo("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n");
?>

<?php //print tree XML getRowsFromDB(0); //Close db connection mysql_close($link); ?>

You are using mysql_query. The mysql extension was deprecated in the PHP 5.5 and most probably is not enabled by default ( if enabled, it will generate a warning message anyway, which may corrupt the XML generation )

So you can enable the mysql extension and supress the warning message. Or upgrade your code and use mysqli or pdo to access data.

Thank you for your reply. The issue turned out to be with the php.ini file that was duplicated in the folder directory and causing quite a bit of confusion for the program. Once the second copy was removed, everything worked as it should. I am also going through and updating all the mysql extension functions to the mysqli extensions to improve the program. Thank you!