Octavian Rasnita wrote:
Hi,

You didn't say if you are running Windows, Linux or something else...

If you have Linux, you probably already have perl. If you use Windows, get and install perl from www.activestate.com.

You must also get and install MySQL from www.mysql.com if you don't have it installed.

Then you need to install the modules DBI and DBD::mysql using (under Unix/Linux):

$ cpan
cpan> install DBI
cpan> install DBD::mysql
or
cpan> force install DBD::mysql

Then you could read more about these modules using:

$ perldoc DBI
$ perldoc DBD::mysql

and you can start using them like:

my $dbh = DBI->connect("dbi:mysql:database=test", "username", "thePassword");

#Create a table
$dbh->do("create table foo(id int unsigned not null autoincrement primary key, body text)");

#Insert a few rows
my $sth = $dbh->prepare("insert into foo(id, body) values(?, ?)");

my @bodies = qw/foo bar baz/;

foreach my $body(@bodies) {
$sth->execute(undef, $body);
}

#select a row
my $sth2 = $dbh->prepare("select id, body from foo where id=?");
$sth2->execute(3);
my ($id, $body) = $sth2->fetchrow_array;

You will find many ways of using DBI from the POD doc.

HTH.

Octavian

----- Original Message ----- From: "Richard Lee" <[EMAIL PROTECTED]>
Cc: <beginners@perl.org>
Sent: Sunday, April 27, 2008 6:24 AM
Subject: sql and perl


Hello guys,

I want to start learning about sql and how it interacts w/ perl.

My rough idea is to install mysql server and read some books to start playing w/ it along w/ perl.
Any advice?

For now, I just plan to go through the book 'mysql and perl for the web'....

If someone can post some excellent site relates to mysql and perl.. would be appreciated. I will post related questions along the way(also, please let me know if this is not the right mailing list for this and if something exists that I am not aware of at this point)

thanks!!

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/



definitely linux!

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to