#!/usr/bin/perl use strict; use CGI qw(:standard); print "Content-type: text/html\n\n"; my $table=param('table'); my $field=param('field'); my $fieldname=param('fieldname'); my $fieldtype=param('fieldtype'); my $fieldlength=param('fieldlength'); my $f; #take number of fields and loop around creating a form my $x=<

Table $table

BEGINX for ($f=1;$f<=$field;$f++) { my $fieldname="fieldname" .$f; my $fieldtype="fieldtype" .$f; my $fieldlength="fieldlength" .$f; my $xxx=< FOO $x.= $xxx; } $x.=<

FOO2 print $x; #### #!/usr/bin/perl use strict; use CGI qw(:standard); use DBI; print "Content-type: text/html\n\n"; my $database="assignments"; my $username="web320"; my $password=""; my $fieldname=param('fieldname'); my $fieldtype=param('fieldtype'); my $fieldlength=param('fieldlength'); my $table=param('table'); my $field=param('field'); #connect to database my $dsn="DBI:mysql:$database:localhost"; my $dbh=DBI->connect($dsn,$username) or die print "doesn't work"; #if use password, put ,$password my $query = "CREATE TABLE $table ($fieldname $fieldtype ($fieldlength))"; #prepare and execute my $sth=$dbh->prepare($query) or die print "bad query"; #$sth->execute(); print $query;
Field Name Field Type Field Length