Porkie Posted July 30, 2009 Share Posted July 30, 2009 i dont know much about xml but could anyone please help me here? XML Parsing Error: XML or text declaration not at start of entity Location: http://www.qasd.co.uk/index.php Line Number 2, Column 2: <?xml version="1.0" encoding="ISO-8859-1" ?> -^ cheers Quote Link to comment https://forums.phpfreaks.com/topic/168203-xml-problems-with-php/ Share on other sites More sharing options...
mikesta707 Posted July 30, 2009 Share Posted July 30, 2009 post some code? post what you expect to happen and what is happening? post something for god's sakes? Quote Link to comment https://forums.phpfreaks.com/topic/168203-xml-problems-with-php/#findComment-887159 Share on other sites More sharing options...
Porkie Posted July 30, 2009 Author Share Posted July 30, 2009 <? class RSS { public function RSS() { require_once ('mysql_connect.php'); } public function GetFeed() { return $this->getDetails() . $this->getItems(); } private function dbConnect() { DEFINE ('LINK', mysql_connect (DB_HOST, DB_USER, DB_PASSWORD)); } private function getDetails() { $detailsTable = "webref_rss_details"; $this->dbConnect($detailsTable); $query = "SELECT * FROM ". $detailsTable; $result = mysql_db_query (DB_NAME, $query, LINK); while($row = mysql_fetch_array($result)) { $details = '<?xml version="1.0" encoding="ISO-8859-1" ?> <rss version="2.0"> <channel> <title>'. $row['title'] .'</title> <link>'. $row['link'] .'</link> <description>'. $row['description'] .'</description> <language>'. $row['language'] .'</language> <image> <title>'. $row['image_title'] .'</title> <url>'. $row['image_url'] .'</url> <link>'. $row['image_link'] .'</link> <width>'. $row['image_width'] .'</width> <height>'. $row['image_height'] .'</height> </image>'; } return $details; } private function getItems() { $itemsTable = "webref_rss_items"; $this->dbConnect($itemsTable); $query = "SELECT * FROM ". $itemsTable; $result = mysql_db_query (DB_NAME, $query, LINK); $items = ''; while($row = mysql_fetch_array($result)) { $items .= '<item> <title>'. $row["title"] .'</title> <link>'. $row["link"] .'</link> <description><![CDATA['. $row["description"] .']]></description> </item>'; } $items .= '</channel> </rss>'; return $items; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/168203-xml-problems-with-php/#findComment-887169 Share on other sites More sharing options...
TeNDoLLA Posted July 30, 2009 Share Posted July 30, 2009 This could be caused by a space or blank line before the <?xml version="1.0" encoding="ISO-8859-1" ?> . You sure there isn't either one? Quote Link to comment https://forums.phpfreaks.com/topic/168203-xml-problems-with-php/#findComment-887212 Share on other sites More sharing options...
Porkie Posted July 30, 2009 Author Share Posted July 30, 2009 positive checked all files cheers for reply tho Quote Link to comment https://forums.phpfreaks.com/topic/168203-xml-problems-with-php/#findComment-887229 Share on other sites More sharing options...
TeNDoLLA Posted July 30, 2009 Share Posted July 30, 2009 Not really sure if this will help but try removing the ?> in the end of the php file. Quote Link to comment https://forums.phpfreaks.com/topic/168203-xml-problems-with-php/#findComment-887245 Share on other sites More sharing options...
sKunKbad Posted July 30, 2009 Share Posted July 30, 2009 Try using a standard opening tag for <?php instead of the short tag <?. Make sure that short tags is OFF in your php.ini Quote Link to comment https://forums.phpfreaks.com/topic/168203-xml-problems-with-php/#findComment-887257 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.