in reply to tracking a syntax error (DBI::MYSQL::st)

I never use bind_param, but I looked it up in the docs. And it seems to me that in that case, $sth->execute should get no parameters. Also, you shouldn't try to insert other statements between two parts of one statement!

So your lines 31-50 should become:

my $sth = $dbh->prepare("UPDATE vitals1 SET id = ?, lnamek = ?, fna +me = ?, lname = ?, address = ?, apt = ?, city = ?, state = ?, zip = ?, dob = ?, men = ?, women = ?, boys = ?, girls = ?") or die "Could not prepare SQL: " . $dbh->errstr(); $sth->bind_param(1, $id); $sth->bind_param(2, $lnamek); $sth->bind_param(3, $fname); $sth->bind_param(4, $lname); $sth->bind_param(5, $address); $sth->bind_param(6, $apt); $sth->bind_param(7, $city); $sth->bind_param(8, $state); $sth->bind_param(9, $zip); $sth->bind_param(10, $dob); $sth->bind_param(11, $men); $sth->bind_param(12, $women); $sth->bind_param(13, $boys,); $sth->bind_param(14, $girls); $sth->execute or die "Could not execute SQL: " . $dbh->errstr();
but I'd prefer to no use bind_param, and do this instead:
my $sth = $dbh->prepare("UPDATE vitals1 SET id = ?, lnamek = ?, fna +me = ?, lname = ?, address = ?, apt = ?, city = ?, state = ?, zip = ?, dob = ?, men = ?, women = ?, boys = ?, girls = ?"); $sth->execute($id, $lnamek, $fname, $lname, $address, $apt, $city, + $state, $zip, $dob, $men, $women, $boys, $girls); or die "Could not execute SQL: " . $dbh->errstr();

Still... are you aware that this SQL statement will update every row in your database table? You don't have a WHERE clause.

Replies are listed 'Best First'.
Re^2: tracking a syntax error (DBI::MYSQL::st)
by Solo (Deacon) on Jun 27, 2006 at 07:37 UTC
    Still... are you aware that this SQL statement will update every row in your database table? You don't have a WHERE clause.

    Unless one of the fields is a primary key, then only one row is updated and a whole bunch of duplicate key update failures are generated (and ignored?).

    --Solo

    --
    You said you wanted to be around when I made a mistake; well, this could be it, sweetheart.