frogman,
Interacting the database with perl is very easy.I'll show you an example how you can do it.I hope you have both mysql and perl installed in your server.
First you should create a table in your mysql.
give table name "emp".then create two fields 'ename' and 'email' in emp table.
Now You can create a html page with a form.
I am giving the html name "test.html".
test.html:
<html>
<head><title>Database test</title></head>
<body>
<h1>Just a Database test</h1>
<form method="post" action="connectivity.cgi">
Ename :<input type="text" name="ename">
Email :<input type="text" name="email">
</form>
</body>
</html>
In "connectivity.cgi" you should write the following
#!/usr/bin/perl
use CGI;
use DBI;
$q=new CGI;
$ename=$q->param('ename');
#get the parameter from your html form.
$email=$q->param('email');
print $q->header;
$dbh=DBI->connect('dbi:mysql:databasename','username','pwd');
#connect to the database ..
#enter your database name ,username and password to the connection string..
$sql="INSERT INTO emp(ename,email) values('$ename','$email')";
$sth = $dbh->prepare($sql)
or die "Can't prepare $sql: $dbh->errstrn";
#pass sql query to database handle..
$rv = $sth->execute
or die "can't execute the query: $sth->errstrn";
#execute your query
if ($rv==1){
print "Record has been successfully updated !!!n";
}else{
print "Error!!while inserting recordn";
exit;
}
I hope this will help you to understand the database connectivity.
You can get some good tutorial for database connectivity with perl at:
www.perl.com/pub/1999/10/DBI.html
------------------
SR -
shiju.dreamcenter.net
"The fear of the LORD is the beginning of knowledge..."
[This message has been edited by Shiju Rajan (edited June 20, 2000).]