that might have been it - no I didn't call the table the same name, but I
certainly typed it there huh. I will try the code now and see what happens.
my biggest concern was if I simple had the necessary pieces to enter the
data into the table. for instance, if I keep calling this script will it
keep dumping the data into new rows, or will the old data be written over?
-t
> On Thu, May 17, 2001 at 12:58:17PM -0500, Todd Marks spake thusly:
> *] #!/usr/bin/perl -w
> *]
> *] use strict;
> *] use CGI qw(:standard);
> *] use DBI;
> *]
> *] # change undef(s) to username and password if required
> *] my $dbh->connect('DBI:mysql:afp', undef, undef);
> *]
>
> What is the name of the table? Is it really the same as the database
> name?
>
> *] my $sth=$dbh->prepare("
> *] INSERT INTO afp
> *] VALUES (?,?,?)
> *] ");
> *]
> I would try
> my $sth=$dbh->prepare(qq(
> insert into afp(name,email,score)
> values (?,?,?)
> ));
>
> doing so you are being specific about the column names and the order
> in which you are going to specify them.
>
> Another trick you can do, expanding on the above:
>
> eval {
> my $sth=$dbh->prepare(qq(
> insert into afp(name,email,score)
> values (?,?,?)
> ));
>
> };
>
> if ($@) {
> print "Error! $@ $\";
> }
>
> Using eval allows you to trap the errors that happen and optionally
> do something about them.
>
> *] $sth->execute('name','email'', '0'') || die "execute insert failed";
> *] $sth->finish();
>
>
> Now that I've had a romp what exactly are you having trouble with?
>
> --
> -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
> Peter L. Berghold [EMAIL PROTECTED]
> "Linux renders ships http://www.berghold.net
> NT renders ships useless...."
>
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php