I'm writing a website which uses a Postgresql database. I've never used Mason or DBI before, and I'm running into the following problem: DBD::Pg::st execute failed: ERROR:  Attribute 'sh' not found at /home/httpd/handler/obj/register.html line 122. Here's the code for the page; I'd trim it but I don't know where the error is coming from, and I'd rather error on the side of too *much* info. The error is referring, as far as I can tell, to the execution of the INSERT statement.
<!-- -*- mmm-classes: mason -*- --> % # Check to see if all of the required arguments arrived. % unless ($username and $password1 and $password2 and $email_address a +nd $birthdate) % { <Head><Title>Missing information</title></head> <Body> <H1>Missing information</h1> <P>Sorry, but your registration information could not be saved because it was missing the following:</p> <ul> % unless ($username) { <li> Username % } % unless ($password1) { <li> Password % } % unless ($password2) { <li> Password Verification % } % unless ($email_address) { <li> E-mail address % } </ul> <P>Please go <a href="register-form.html">back</a>, and fill in the missing information.</p> </body> % } elsif ($password1 != $password2) { <head> <title>Password Entries Do Not Match</title> </head> <body> <h1>Password Entries Do Not Match!</h1> <p>We're sorry, you must enter the same password in both fields. <P>Please go <a href="register-form.html">back</a>, and fill in the missing information.</p> </body> % } else { <%perl> # Let's see if this username is already taken $sql = "SELECT uid "; $sql .= "FROM Users "; $sql .= "WHERE user_name = ?"; $sth = $dbh->prepare($sql); $result = $sth->execute($username); my ($user_name_taken) = $sth->fetchrow_array; $sth->finish; <!- perl> % if ($user_name_taken) { <Head><Title>Username already taken</title></head> <Body> <H1>Username already taken </h1> $sth = $dbh->prepare($sql); $result = $sth->execute($username); my ($user_name_taken) = $sth->fetchrow_array; $sth->finish; <!- perl> % if ($user_name_taken) { <Head><Title>Username already taken</title></head> <Body> <H1>Username already taken </h1> <P>Sorry, but the username <b><% $username %></b> has already been taken by someone else. Please try to <a href="register-form.html">register</a> with a different username.</p> % } else { <%perl> # Since this username is unique, we can # store this user's information in the database $sql = "INSERT INTO users "; $sql .= " (user_name, user_password, user_birthdate, user_homepage, us +er_email)"; $sql .= " VALUES "; $sql .= " (?, ?, ?, ?, ?)"; $sth = $dbh->prepare($sql); $result = $sth->execute($username, $password1, $birthdate, $homepage, +$email_address); $sth->finish; <!- perl> % if ($result) { <%perl> $sql = "SELECT uid "; $sql .= "FROM Users "; $sql .= "WHERE user_name = ?"; $sth = $dbh->prepare($sql); $result = $sth->execute($username); my ($user_name_taken) = $sth->fetchrow_array; $sth->finish; <!- perl> % $session{user_id} = $user_id; <Head><Title>Registration inserted</title></head> <Body> <H1>Registration inserted</h1> <P>Your registration was successful.</p> <P>Welcome, <b><% $username %></b>!</p> % } else { <Head><Title>Error registering</title></head> <Body> <H1>Error registering</h1> <P>Sorry, but your registration was unsuccessful.</p> % } # Checking $result % } # Checking $user_name_taken % } # Ending top-level if/else <%once> my ($dbh, $sql, $sth, $result, $user_id); <!- once> <%init> $dbh = $m->comp("dbconnect.mcomp"); <!- init> <%args> $username => undef $password1 => undef $password2 => undef $email_address => undef $birthdate => undef $homepage => undef <!- args>

In reply to DBD::Pg problems by dstar

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.