Hardy Merrill [EMAIL PROTECTED] wrote: 
> 
> You really need to read 'perldoc DBI' (at a command prompt) and pay
> attention to how placeholders are used. See below.  As Dave Murray
> suggested, the Programming the Perl DBI book would be a good
> investment.
> 
> >           $dbh->do(qq{
> >                    INSERT INTO acct_db VALUES(?,?,?,?,?,?,?)},
> >                    undef,$key1,$uid,$gid,$gcos,$home,$shell,NOW())
> >                 or print "Error updating database:  ", $dbh->errstr,
> > "\n";
> 
> HM@@ I don't think(?) you can use placeholders with the "do" command,
> but I'm really not sure.

Placeholders are perfectly acceptable with the do() command, and Scott's
syntax is correct:

$dbh->do($stmt, \%attribs, @bind_values);

This is documented in perldoc DBI, of course.


NOW(), however, is a MySQL function, not a Perl function.  It can't be
passed as a bind value; it must be part of the actual SQL statement.


Ronald

Reply via email to