Hi again,
still struggling here, would appreciate it if someone could help me with the below code which fails.
The below code fails on the line:
$dbh->func( 'users', 'CSV', 'users.csv' 'ad_catalog');
Cheers!
-----------------
#!/usr/bin/perl -w
use strict;
require 'html.pl';
use lib './MyLib';
use DBI;
my $dbh = DBI->connect('dbi:AnyData(RaiseError=>1):');
$dbh->func( 'users', 'CSV', 'users.csv' 'ad_catalog');
my $sth = $dbh->prepare("SELECT surname FROM users");
$sth->execute();
while (my $row = $sth->fetch) {
print "@$row\n";
}
# define variables
header();
print("<table width='90%'>");
print("<TR valign='top'><TD width='30%'>");
print ("Menu<BR>");
print ("====<BR>");
print ("<a href='create-user.cgi'>Create New User</a><BR>");
print ("Login User<BR>");
print ("User Admin<BR>");
print("</TD>");
print("<TD>");
print ("CREATE USER<BR>");
print ("==========<BR>");
print ("This is where the code to create new users will be place
+d");
print ("<P>");
print ("USER VARIABLES<HR>");
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, ">./user_data/test_user");
while (($a, $b) = each(%user_data)){
print ("Key = $a and its value is $b<BR>");
print OUTFILE ("$a\n$b");
}
close (OUTFILE);
print ("<HR>USERS ON SYSTEM<HR>");
opendir(USERS, "./user_data");
while ( my $name = readdir(USERS)) {
if ($name ne '.' and $name ne '..') {
print ("<a href='./user_data/$name'>$n
+ame</a><BR>");
}
}
closedir(USERS);
print("</TR>");
print("</table>");
Kia Kaha, Kia Toa, Kia Manawanui!
Be Strong, Be Brave, Be perservering!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Outside of code tags, you may need to use entities for some characters:
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|