> I am just learning mysql and I'm trying to write a cgi to update the > database from a form. Also just learning Perl. I have the following script > started that is called by an HTML form. I get the follwing message when I > execute it. Where can I find the message descriptions. > > DBI::st=HASH(0x1b31f28) > > this is my script so far: > #!c:\perl\bin\perl > > use DBI(); > print "Content-type:text/html\n\n"; > > #Connect to database members. > > $database = "members"; > $table = "members"; > > $dbh = DBI->connect("DBI:mysql:$database")or > dienice("Can't connect:$DBI::errstr"); > > $sth = $dbh->prepare("select > membername,address,city,state,zipcode,phonenumber from members")or > dienice("Can't prepare statement: ",$dbh->errstr); > > print $sth; > > exit;
I don't see where you're logging in to the database. You won't get anything back from your queries until you do. Something like this: # connect to database $dbh = DBI->connect ($dsn, $user, $password, { RaiseError => 1,PrintError=>0 }) or die "Could not connect to server $dsn: $DBI::err ($DBI::errstr)\n"; Also don't forget to ... $dbh->disconnect; after you're all done. Here's something you might want to add to the top of all your scripts. BEGIN { open (STDERR,">>$0-err.txt"); print STDERR "\n",scalar localtime,"\n"; } It prints the error file to $0 (the name of the current script) -err.txt in the same directory as the script, so you don't have to chase it down in the web server log files. Comment it out when the script is working otherwise the log file just keeps going, and going, and .... Also, I installed my perl in c:\usr\bin so I don't have to keep changing the path every time I upload it to a *nix box. -- /* All outgoing email scanned by AVG Antivirus /* Amer Neely, Softouch Information Services W: www.softouch.on.ca E: [EMAIL PROTECTED] V: 519.438.5887 Perl | PHP | MySQL | CGI programming for all data entry forms. "We make web sites work!" -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]