Hi Everybody,
Is there a shortcut way to subtract dates say for instance I would like to
be subtracting the current date from the date that the service for a
particular user expires, say (expiry date -- current date). Or do I have to
write
a specific script for this. Forgive my newbie ignorance.
Kregards,
Ackim.
.--- Original Message -----
From: Peter Hanson <[EMAIL PROTECTED]>
To: Ackim Chisha <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, July 16, 2001 11:56 AM
Subject: RE: Searching a MYSQL database
> 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]
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]