Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > Re: sql and per...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 12 of 25 Topic 10992 of 11509
Post > Topic >>

Re: sql and perl

by orasnita@[EMAIL PROTECTED] (Octavian Rasnita) Apr 27, 2008 at 11:06 AM

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 @[EMAIL PROTECTED]
 = qw/foo bar baz/;

foreach my $body(@[EMAIL PROTECTED]
) {
$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" <rich.japh@[EMAIL PROTECTED]
>
Cc: <beginners@[EMAIL PROTECTED]
>
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: beginners-unsubscribe@[EMAIL PROTECTED]
> For additional commands, e-mail: beginners-help@[EMAIL PROTECTED]
> http://learn.perl.org/
>
>
 




 25 Posts in Topic:
Creating PID file
mbarnes@[EMAIL PROTECTED]  2008-04-26 20:30:17 
Re: Creating PID file
rob.dixon@[EMAIL PROTECTE  2008-04-27 02:49:47 
RE: Creating PID file
MBarnes@[EMAIL PROTECTED]  2008-04-26 23:49:23 
RE: Creating PID file
MBarnes@[EMAIL PROTECTED]  2008-04-27 17:24:54 
Re: Creating PID file
rob.dixon@[EMAIL PROTECTE  2008-04-28 06:48:29 
Re: Creating PID file
chas.owens@[EMAIL PROTECT  2008-04-27 04:53:22 
Re: Creating PID file
peng.kyo@[EMAIL PROTECTED  2008-04-27 16:59:52 
Re: Creating PID file
chas.owens@[EMAIL PROTECT  2008-04-27 05:03:56 
Re: Creating PID file
peng.kyo@[EMAIL PROTECTED  2008-04-27 09:50:51 
Re: Creating PID file
peng.kyo@[EMAIL PROTECTED  2008-04-27 10:36:11 
sql and perl
rich.japh@[EMAIL PROTECTE  2008-04-26 23:24:22 
Re: sql and perl
orasnita@[EMAIL PROTECTED  2008-04-27 11:06:23 
Re: sql and perl
rich.japh@[EMAIL PROTECTE  2008-04-27 12:25:59 
Re: sql and perl
rvtol+news@[EMAIL PROTECT  2008-04-28 09:54:43 
Re: sql and perl
rob.dixon@[EMAIL PROTECTE  2008-04-28 09:20:07 
Re: sql and perl
rich.japh@[EMAIL PROTECTE  2008-04-28 10:19:51 
Re: sql and perl
peng.kyo@[EMAIL PROTECTED  2008-04-27 11:34:01 
Re: sql and perl
rich.japh@[EMAIL PROTECTE  2008-04-26 23:42:24 
Re: Creating PID file
orasnita@[EMAIL PROTECTED  2008-04-27 10:56:58 
Re: sql and perl
dan@[EMAIL PROTECTED] (D  2008-04-28 18:15:36 
Re: sql and perl
ficovh@[EMAIL PROTECTED]   2008-04-28 10:40:29 
Re: sql and perl
rob.dixon@[EMAIL PROTECTE  2008-04-28 17:52:53 
RE: sql and perl
rvm@[EMAIL PROTECTED] (B  2008-04-28 14:40:25 
Re: sql and perl
rob.dixon@[EMAIL PROTECTE  2008-04-28 20:06:21 
RE: sql and perl
andrew.curry@[EMAIL PROTE  2008-04-29 00:09:11 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 23 21:14:49 CDT 2008.