Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
03-12-2010, 09:29 PM #1
- Join Date
- Aug 2007
- Thanked 0 Times in 0 Posts
Can you have an XML file created from a database using PHP
I'm not sure this is possible but i have a flash video jukebox section on my site that has a tileList that is populated by an XML file. I would like to add the information to the XML file through a MySQL database using php if possible.
Right now i have this code that calls the information in the XML format but how do i get his to save as an XML file?
//XML output of an existing MySql database
//to create connection to database
$connection = mysql_connect("localhost","root", "root")
or die ("could not connect to database");
//to select the database here
$db = mysql_select_db("motorsports",$connection)
or die ("Couldn't select database.");
$rs = mysql_query("select vid_desc, src, thumb FROM video_blog ORDER BY date_id DESC",$connection)
or die ("invalid query");
//count the no. of columns in the table
$fcount = mysql_num_fields($rs);
//you can choose any name for the starting tag
while($row = mysql_fetch_array( $rs ) )
for($i=0; $i< $fcount; $i++)
$tag = mysql_field_name( $rs, $i );
echo ("<$tag>". $row[$i]. "</$tag>");
Thanks in advance for any help you can give.
03-12-2010, 09:45 PM #2
- Join Date
- Dec 2005
- Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
- Thanked 637 Times in 625 Posts