Linux-Bulgaria.ORG
навигация

 

начало

пощенски списък

архив на групата

семинари ...

документи

как да ...

 

 

Предишно писмо Следващо писмо Предишно по тема Следващо по тема По Дата По тема (thread)

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



 

наши приятели

 

линукс за българи
http://linux-bg.org

FSA-BG
http://fsa-bg.org

OpenFest
http://openfest.org

FreeBSD BG
http://bg-freebsd.org

KDE-BG
http://kde.fsa-bg.org/

Gnome-BG
http://gnome.cult.bg/

проект OpenFMI
http://openfmi.net

NetField Forum
http://netField.ludost.net/forum/

 

 

Linux-Bulgaria.ORG

Mailing list messages are © Copyright their authors.