<?xml version="1.0" encoding="windows-1252"?>
<node id="314689" title="Re: Re: Re: Re: DBD::CSV - how to install? (FTP only)" created="2003-12-14 16:53:48" updated="2004-08-22 16:25:39">
<type id="11">
note</type>
<author id="218156">
lwicks</author>
<data>
<field name="doctext">
Hi again,&lt;BR&gt;
still struggling here, would appreciate it if someone could help me with the below code which fails.&lt;P&gt;

The below code fails on the line:&lt;BR&gt;
    $dbh-&gt;func( 'users', 'CSV', 'users.csv' 'ad_catalog');&lt;P&gt;

Cheers!&lt;P&gt;
-----------------&lt;P&gt;


&lt;code&gt;
#!/usr/bin/perl -w
use strict;
require 'html.pl';
use lib './MyLib';




  use DBI;
  my $dbh = DBI-&gt;connect('dbi:AnyData(RaiseError=&gt;1):');
  $dbh-&gt;func( 'users', 'CSV', 'users.csv' 'ad_catalog');
  my $sth = $dbh-&gt;prepare("SELECT surname FROM users");
  $sth-&gt;execute();
  while (my $row = $sth-&gt;fetch) {
      print "@$row\n";
  }



# define variables


header();
print("&lt;table width='90%'&gt;");
print("&lt;TR valign='top'&gt;&lt;TD width='30%'&gt;");

      print ("Menu&lt;BR&gt;");
      print ("====&lt;BR&gt;");
      print ("&lt;a href='create-user.cgi'&gt;Create New User&lt;/a&gt;&lt;BR&gt;");
      print ("Login User&lt;BR&gt;");
      print ("User Admin&lt;BR&gt;");
      print("&lt;/TD&gt;");
print("&lt;TD&gt;");
      print ("CREATE USER&lt;BR&gt;");
      print ("==========&lt;BR&gt;");
      print ("This is where the code to create new users will be placed");
      print ("&lt;P&gt;");

     print ("USER VARIABLES&lt;HR&gt;");
my %user_data = qw(
id	blank
first_name		blank
surname		blank
date_of_birth	blank
email			blank
password		blank
active		blank
last_login		blank
create_date		blank
earnings		blank
cash			blank
judoka_limit	blank
sensei_limit	blank
dojo_limit		blank
team_limit		blank
rank			blank
);
open (OUTFILE, "&gt;./user_data/test_user");
while (($a, $b) = each(%user_data)){
	print ("Key = $a and its value is $b&lt;BR&gt;");
        print OUTFILE ("$a\n$b");
}
close (OUTFILE);

print ("&lt;HR&gt;USERS ON SYSTEM&lt;HR&gt;");
opendir(USERS, "./user_data");
while ( my $name = readdir(USERS)) {
                                if ($name ne '.' and $name ne '..') {
                                print ("&lt;a href='./user_data/$name'&gt;$name&lt;/a&gt;&lt;BR&gt;");
                                }
}
closedir(USERS);

print("&lt;/TR&gt;");
print("&lt;/table&gt;");

&lt;/code&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-218156"&gt;
Kia Kaha, Kia Toa, Kia Manawanui!&lt;BR&gt;
Be Strong, Be Brave, Be perservering!
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
314564</field>
<field name="parent_node">
314676</field>
</data>
</node>
