Below is a mysql approach using DBD::Mysql which can be generalized to 
DBI pretty easily.

#!/usr/bin/perl
use Mysql;

# connect
if (!($dbh=Mysql->connect('localhost','<databasename>'))) {print 
"Connect error. Please try back later.";exit;}

#sample query
$statement="SELECT id,name,location,setting FROM users WHERE setting='55'";
if (!($sth=$dbh->query($statement))) {print "Select error. 
$statement";exit;}

$rows=$sth->numrows;
print "Found $rows records.\n";
if ($rows) {
    while (%row = $sth->fetchhash) {
       print "Name: $row{'name'}\n";
       # repeat....
    }
}
print "Done.\n";

You get the basic idea from this (untested).

As far as XML I would guess you are going to need to be more specific 
about what exactly you want to do DOM/SAX, etc. But there is the Perl 
and XML book to check out, I highly recommend it for perl programmers 
new to XML (as I am myself and just finished it).

http://danconia.org/



[EMAIL PROTECTED] wrote:
> Hey im thinking of doing some perl stuff with xml.. but I have no experiance 
> in it.. a friends site offers their news links in xml format.. what I need to 
> do is to open a connection to there site.. read that file then display it on 
> my own site.  any ideas one working with xml? 
> 
> Also can someone give me an example of accessing a mySQL database that has 
> the fields id, name, location, setting; and printing out all the entries that 
> the setting is 55? the table is users, thanx a lot!
> 
> Dra'
> 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to