Try this:

#!/usr/bin/perl -w

use strict;
use DBI;

my $user = 'bob';

my $dbh = DBI->connect('DBI:mysql:database=foo;host=55.55.55.55',
                        'test',
                        'test',);
  my $cursor = $dbh->prepare("Select user from foo where exp = curdate\(\)
and user = '$user'");
  $cursor->execute;
  my $foo = $cursor->fetchrow;
  $cursor->finish;
$dbh->disconnect;

print "$foo\n";

Output should give you bob.

You'll also need DBI and DBD::mysql installed, though you already probably
knew that.

Check out these for more info:
  perldoc DBI
  perldoc DBD::mysql


Pete Hanson
source1results.com


-----Original Message-----
From: Ackim Chisha [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 16, 2001 1:26 AM
To: [EMAIL PROTECTED]
Subject: Searching a MYSQL database


People,
Forgive me am a newbie just started learning perl two days ago. I would like
to find out if its possible with perl I can search a MYSQL database  for a
particular username and look for for the expiry date and compare it with the
current date to determine whether expired or not.
Any help will be appreciated or a website that could give me some hints.

Thanks

Ackim


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to