bladx has asked for the wisdom of the Perl Monks concerning the following question:
+----+----------+----------+-------+-----------------+ | id | nickname | password | socks | favorite_number | +----+----------+----------+-------+-----------------+ | 1 | Cowlick | salty | 0 | 4 | | 2 | andy | bandy | 3 | 7 | +----+----------+----------+-------+-----------------+
#!/usr/bin/perl -w use warnings; use strict; use DBI; my $dsn = 'DBI:mysql:test:localhost'; my $db_user_name = ''; my $db_password = ''; my ($id, $password); my $dbh = DBI->connect($dsn, $db_user_name, $db_password); my $input_nickname = 'Cowlick'; my $input_password = 'salty'; my $sth = $dbh->prepare( qq/select id, password from users where nickname = '$input_nickname'/); $sth->execute(); ($id, $password) = $sth->fetchrow_array(); $sth->finish(); if ($input_password eq $password) { print "\nLogin Successful!\n"; print "Here are the stats:\n"; print "="x20,"\n"; print "id = $id, nick=$input_nickname, pass = $password\n"; } $dbh->disconnect();
my $sth = $dbh->prepare( qq/select * from users/);
my $sth = $dbh->prepare( qq/select id, password from users where nickn +ame = '$input_nickname'/);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(jeffa) Re: How can I display an entire MySQL table in Perl?
by jeffa (Bishop) on Jan 02, 2002 at 03:03 UTC | |
by Trimbach (Curate) on Jan 02, 2002 at 04:07 UTC | |
|
Re: How can I display an entire MySQL table in Perl?
by ellem (Hermit) on Jan 02, 2002 at 06:00 UTC | |
by jeffa (Bishop) on Jan 02, 2002 at 21:59 UTC | |
by ellem (Hermit) on Jan 04, 2002 at 02:01 UTC | |
by Anonymous Monk on Jan 31, 2002 at 09:41 UTC | |
by ellem (Hermit) on Feb 01, 2002 at 06:59 UTC | |
|
Re: How can I display an entire MySQL table in Perl?
by jonjacobmoon (Pilgrim) on Jan 02, 2002 at 06:36 UTC | |
by hakkr (Chaplain) on Jan 02, 2002 at 18:34 UTC |