#! /usr/bin/perl print "Content-type: text/html\n\n"; print "Result of the insert operation "; use CGI ':standard'; use DBI; $dbh=DBI->connect("DBI:mysql:test","root",""); $name=param("name"); $age=param("age"); $qh=$dbh->prepare("insert into stud values('$name','$age')"); $qh->execute(); $qh=$dbh->prepare("select * from stud"); $qh->execute(); print ""; while ( ($name,$age)=$qh->fetchrow()) { print ""; } print "
NameAge
$name$age
"; $qh->finish(); $dbh->disconnect(); print"";