in reply to My first MySQL database
I'm not familier with the Mysql module. I'd suggest checking out DBI. DBI is an abstraction layer that allows you to connect to several different popular databases. Here's a quick example on using it with MySQL:
#!/usr/bin/perl use strict; use warnings; use DBI; my $dsn = "DBI:mysql:host=somehost;database=db-you-want"; my $dbh = DBI->connect($dsn,"user","password") or die "Couldn't connec +t: " . DBI->errstr(); my $query = "SELECT somestuff FROM sometable WHERE somefield='somethin +g'; my $sth = $dbh->do($query); while(my $somestuff = $sth->fetchrow()) { # do something interesting ... } $sth->finish(); $dbh->disconnect();
Hope that helps
chris
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: My first MySQL database
by sulfericacid (Deacon) on Feb 10, 2003 at 19:17 UTC |