I have this script, but i am not sure if it will do my job

[email protected] ("mel awaisi") Sat, 08 Mar 2003 02:32:15 +0000
Newsgroups perl.scripts
Message-ID <[email protected]>
Hi

I have a script that takes images (coming from camera) named image.jpg, and 
renames them to the date of when the image has been taken, and then stores 
them in /home/me/images/2003_7_3_12_26_34.jpg.

the second part of the script is as follows. after the image has been 
renamed, i would like to send the image header (image_name, image_size, and 
image_date_modified) to MySQL. i am a beginner, and this is just a try. 
could some one please look at it, and tell me, what is missing?


use DBI;
#################################################################   Connect 
to Database Named cctvimages on the localhost with the root user   #
#   $dbh=DBI->connect(DBI:mysql;$database", $user, $password);
################################################################
my $dbh = DBI->connect("DBI:mysql:database=cctvimages; host=localhost", 
"root", "mel", {'RaiseError' => 1});

################################################################# Insert the 
image_name, image_size and the image_date_modified to imageheader table#
# with the values from renamed images coming from /home/me/images/           
        #
################################################################
$statement = "INSERT INTO imageheader
(image_name, image_size, image_date_modified)
VALUES
('$image_name', '$image_size', '$image_date_modified')";

$sth = $dbh->prepare($statement) or die "Can't prepare $statement: " . 
$dbh->errstr . "\n";
$sth->execute or die "Can't execute the query: " . $dbh->errstr . "\n";
$sth->finish;
$dbh->disconnect();


Regards,

Mel

_________________________________________________________________
Surf together with new Shared Browsing 
http://join.msn.com/?page=features/browse&pgmarket=en-gb&XAPID=74&DI=1059