Hi,
--- On Tue, Nov 3, 2009 at 3:58 PM, Raman.P <[email protected]> wrote:
| require DBI;
\--
Also to include:
use strict;
use warnings;
---
| my $dbh = DBI->connect("DBI:CSV:");
\--
Need to always check for connection failure:
my $dbh = DBI->connect( "DBI:CSV:" )
or die "Couldn't connect to database: " . $dbh->errstr;
---
| $sth = $dbh->prepare("SELECT * FROM passwd where login
like 'ram%'");
\--
One can also put the SQL query in a separate variable like:
my $name = $dbh->quote( "ram%" );
my $sql = qq/select * from passwd where login = '$name'/;
my $sth = $dbh->prepare( $sql );
---
| while (@array=$sth->fetchrow_array()){
| print "@array\n\n";
| }
\--
Use:
while ( @array = $sth->fetchrow_array() ) {
print "@array\n\n";
}
SK
--
Shakthi Kannan
http://www.shakthimaan.com
_______________________________________________
To unsubscribe, email [email protected] with
"unsubscribe <password> <address>"
in the subject or body of the message.
http://www.ae.iitm.ac.in/mailman/listinfo/ilugc