Hello, everyone. This may be a noobly question, but for the program I'm trying to create, I need the script to recieve input from an HTML script, use that input(in this case, a name) to search for corresponding information about that person in more than one table, and then return the results to the script, which, in turn, returns it to the web browser. The problem I'm having, however, is that at line 26, the error I'm getting is "too many arguments to connect". Why? What can I do differently to make this script work? The code is all shown below:

#!/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 "<p><br />Error: No Matches were found for your search. Did you +include capital letters?</p><br /><br />";} if($contactid ne "0") {print "<br /><br /><p>This is the information returned from your quer +y:</p><br /><br />";} 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_e +mployed, $email_address, $home_phone_number, $emergency_phone_number) = $sth_>f +ethrow_array()) { print "<p>Employee ID: $id<br /><br />Last Name: $lastname<br /><b +r /> Date First Employed: $date_first_employed<br /><br /> Annual Salary: $annual_salary<br /><br />Contact ID: $contactid<br + /><br /> Email Address: $email_address<br /><br />Home Phone Number: $home_ +phone_number<br /><br /> Emergency Phone Number: $emergency_phone_number</p><br /><br />"; } $sth_>finish( ); $dbh_>disconnect( );

In reply to Too many arguments to connect-help? by steampunk333

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.