#!/usr/bin/perl use DBI; use warnings; my $firstname = $in{name}; my $db = "project_database"; my $host = "localhost"; my $user = "phillip"; my $pw = "steampunk333"; my $source = "DBI:mysql:database = project_database: host = localhost"; my $contactid; my $dbh; print "Content-type:text/html\n\n"; $dbh = DBI_>connect($source,$user,$pw) or die "Can't connect to database: $DBI::errstr\n"; my $qfirstname = dbh_>quote($firstname); if ($firstname eq "Alan") {$contactid = "Alan W.";} elsif ($firstname eq "Jake") {$contactid = "Jake M.";} elsif ($firstname eq "Jessica") {$contactid = "Jessica S.";} elsif ($firstname eq "Jim") {$contactid = "Jim S.";} else {$contactid = "0"; print "


Error: No Matches were found for your search. Did you include capital letters?



";} if($contactid ne "0") {print "

This is the information returned from your query:



";} my $qcontactid = dbh_>quote($contactid); my $sth = $dbh_>prepare("SELECT lastname, date_first_employed, annual_salary FROM employees WHERE firstname = $qfirstname, SELECT * FROM employee_contacts WHERE contact_id = $qcontactid"); $sth_>execute( ); while (($lastname, $date_first_employed, $annual_salary, $date_first_employed, $email_address, $home_phone_number, $emergency_phone_number) = $sth_>fethrow_array()) { print "

Employee ID: $id

Last Name: $lastname

Date First Employed: $date_first_employed

Annual Salary: $annual_salary

Contact ID: $contactid

Email Address: $email_address

Home Phone Number: $home_phone_number

Emergency Phone Number: $emergency_phone_number



"; } $sth_>finish( ); $dbh_>disconnect( );