|
Re: lug-bg: mySQL i bash script
- Subject: Re: lug-bg: mySQL i bash script
- From: draychev@xxxxxx (Delyan Raychev)
- Date: Tue, 02 Apr 2002 19:23:38 -0500
E neka da ne e bash a perl. Mozhe li?
Ako imash perl - eto neshto lesno...
use DBI;
my $dbh = DBI->connect('DBI:MySQL:DataBase')
or die "Couldn't connect to database: " . DBI->errstr;
my $sth = $dbh->prepare('SELECT * FROM people WHERE lastname = ?')
or die "Couldn't prepare statement: " . $dbh->errstr;
$sth->execute($lastname) # Execute the query
or die "Couldn't execute statement: " . $sth->errstr;
# Read the matching records and print them out
while (@data = $sth->fetchrow_array()) {
my $firstname = $data[1];
my $id = $data[2];
}
$sth->finish;
}
$dbh->disconnect;
Upseh!
Delyan Raychev
draychev@xxxxxx
Konstantin Ivanov wrote:
>Kak moga da napisha bash script s koito da pravia query-ta v mysql baza
>danni, syshtoto sam go postignal s PGP prez web, no ne mi e mnogo iasno
>kak da stane sys shell komandi.
>
===========================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers)
http://www.linux-bulgaria.org/ Hosted by Internet Group Ltd. - Stara Zagora
|
|
|