Jump to content

Using PHP to take data off MYSQL into XML and including the html elements


nade93

Recommended Posts

Hi All

 

I taking certain text info from MYSQL database to insert it into the following xml file

 

<?php

mysql_connect("mysql1063.servage.net", "ysalon", "eldonsquare") or die(mysql_error());

mysql_select_db("ysalon") or die(mysql_error());

$result = mysql_query("SELECT introtext FROM jos_content WHERE id=1");

$row = mysql_fetch_assoc($result);

echo $row['introtext'];





?> 

I then parse this through to my flash file and works fine. The "introtext" is taken from the joomla cms system for an article and i need the html elements (such as formating) to be also applicable to the xml file so it shows up the formating correctly in the flash file. (i.e. such as <br> and <p> elements) At the moment it is just showing the actual code rather than the effects of the code

 

any help would be great

 

thanks

To make things simple, you are trying to make this php document as xml?  You need to set headers first:

 

header('Content-type: application/xml');

 

and you also need to make sure you have the xml tag at the beginning:

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.