Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2004
    Posts
    1

    Unanswered: connecting to a perl database???

    Hi i have been trying to connect my perl program to a database through DBD::CSV. The database file (called basket) is stored in a local directory and has the following columns;

    username,itemid,numberofitems

    However my object doesnt seem to be recognising something and therefore it does not work.The code for the object file that i am using is as follows, please try and see if you can amend it so that it at least connects. Thank you, much appreciated.

    ############################################

    #! /usr/bin/perl

    use strict;
    use warnings;
    use DBI;

    my $dbh = DBI->connect("DBI:CSV:f_dir=data" );
    my $sth = $dbh->prepare("SELECT username FROM basket");
    $sth->execute();
    while(my ($result) = $sth->fetchrow_array()){
    print $result,"\n";
    }
    $dbh->disconnect();

    #################################################

  2. #2
    Join Date
    Aug 2004
    Posts
    5
    erm.. yeh right.. hahahahah.. its the same as mine u joker!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •