#!/usr/bin/perl #search the LRI database use CGI; use DBI; print "Content-type: text/html\n\n"; $a = <<"ENDA"; LRI & Odour Database on the Web ENDA print $a; $query = new CGI; $Ref = $query->param('Ref'); # Open the database $hostname = "localhost:3306"; $database = "rmottram_odour"; $user="rmottram_odour"; $password="kja3vcu!eqk4WZF0epa"; $|=1; # Don't buffer output $dbh = DBI->connect("DBI:mysql:$database:$hostname", $user, $password); $statement = "SELECT Author, Title, Reference FROM Reference where ID='$Ref'"; $sth = $dbh->prepare($statement) or die "can't prepare the statement"; $rv = $sth->execute or die "can't execute the query: $sth->errstr"; @row = $sth->fetchrow_array; print "Reference: $Ref
"; print "Author: $row[0]
"; print "Title: $row[1]
"; print "Reference: $row[2]"; $a = <<"ENDB"; ENDB print $a; #$rc = $sth->finish; #$rc = $dbh->disconnect;