MySQL Forums
Forum List  »  Connector/Node.js

XML/mySQL for dummies?
Posted by: Jason Durham
Date: September 04, 2006 10:57AM

I'm a graphic designer doing a website for a club I belong to. There is a portion of the website where I have some content which will need to be updated regularly. The website was designed in Flash 8 Professional and is linked to an XML file located in the site root called gallery.xml

Basically, I need to find a way to add entries to this XML document. I figured I could create an HTML form to update a mySQL db and have the db generate an updated gallery.xml.

The XML document is formatted like this...

<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Edited with Macromedia Dreamweaver -->

Some of the fields will have special characters ("/", "-", "*", etc.) as some of the members use those in their 'username'. From my searching on the web, I found this query...

use strict;
use DBI;

my $dbh = DBI->connect ("DBI:mysql:HOSTNAME",
{ RaiseError => 1, PrintError => 0});
my $sth = $dbh->prepare ("SELECT Name, category FROM masterTbl");
$sth->execute ();
print "<?xml version=\"1.0"\"?>\n";
print "<gallery>\n";
while (my ($Name, $Username, $Year, $Make, $Model, $Website, $Picture) = $sth->fetchrow_array ())
print " <member>\n";
print " <name>$Name</name>\n";
print " <year>$Year</year>\n";
print " <make>$Make</make>\n";
print " <model>$Model</model>\n";
print " <website>$Website</website>\n";
print " <username>$Username</username>\n";
print " <picture>$Picture</picture>\n";
print " </member>\n";
$dbh->disconnect ();
print "</gallery>\n";

Unfortuantely, I don't have much experience with SQL to know where to put this or how to use it. Am I barking up the right tree? Anybody have any words of wisdom? TIA!

Options: ReplyQuote

Written By
XML/mySQL for dummies?
September 04, 2006 10:57AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.