
wayko621
Novice
May 16, 2002, 5:06 AM
Views: 10350
|
well i got a bit further i re-installed active perl and dbi and dbd-odbc now i get a new error that make me happy :) this is a test Content-type: text/html Software error:Can't call method "do" on an undefined value at C:\Inetpub\wwwroot\cgi-bin\database1.pl line 21. For help, please send mail to this site's webmaster, giving this error message and the time and date of the error. here is the new coding use CGI; use CGI::Carp 'fatalsToBrowser'; #!/usr/bin/perl $first = $field{'first'}; $last = $field{'last'}; $address = $field{'address'}; $email = $field{'email'}; $phone = $field{'phone'}; $user = $field{'user'}; $pass = $field{'pass'}; use DBI; $dbh = DBI->connect("dbi:ODBC:'driver = Driver do Microsoft Access(*.mdb); dbq=test.mdb'"); print "Content-Type: text/html\n\n"; print"<html><body><h1>this is a test</h1>"; $sql = qq{INSERT INTO Dreamcpu (FirstName,LastName,Address,Email,Phone,Username,Password) VALUES ('$first','$last','$adress','$email','$phone','$user','$pass');}; $rc = $dbh->do($sql); print"$rc record(s) were added.<p>"; $sth = $dbh->prepare("SELECT * FROM Dreamcpu"); $sth->execute(); print"<table>\n"; print"<tr><th>ID</th><th>First</th><th>Last</th><th>Address</th><th>Email</th><th>Phone</th><th>User</th><th>Password</th>\n" ; while (@row = $sth->fetchrow_array) { print"<tr>"; foreach(@row) { print"<td>$_</td>"; } print"</tr>\n"; } print"</table>\n"; print"</body></html>"; $sth->finish; $dbh->disconnect;
(This post was edited by wayko621 on May 16, 2002, 5:31 AM)
|