Check your quotes. You are using double quotes within a double-quoted string - and that's never going to work. I recommend switching to qq().
Also, you need to use the concaternation operator and more quotes to include the parameter value in the string.
Oh. And your order clause isn't right.
$sth = $dbh->prepare(qq( SELECT * FROM $pictures_table WHERE stats="2" AND poster_name = ') . param('name') . qq(' ORDER BY poster_name ASC));
Actually, it might be easier to use a placeholder to insert the parameter. That way you don't need to worry about the quoting.
$sth = $dbh->prepare(qq( SELECT * FROM $pictures_table WHERE stats="2" AND poster_name = ? ORDER BY poster_name ASC)); $sth->execute(param('name'));
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re: single error with a dbh prepare
by davorg
in thread single error with a dbh prepare
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |