Leser: 15
1 2 3
my $sql = "SELECT * FROM news order by date DESC Limit ?,?"; my $sth = $dbh->prepare($sql) || die "$DBI::errstr"; $sth->execute($start,$proseite) || die "$DBI::errstr";
QuoteYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''0','4'' at line 1 at /home/......
1 2 3
my $sql = "SELECT * FROM news order by date DESC Limit $start,$proseite"; my $sth = $dbh->prepare($sql) || die "$DBI::errstr"; $sth->execute() || die "$DBI::errstr";
1 2 3
my $sql = "SELECT * FROM news order by date DESC Limit ?,?"; my $sth = $dbh->prepare($sql) || die "$DBI::errstr"; $sth->execute($start,$proseite) || die "$DBI::errstr";
1 2 3
my $sql = "SELECT * FROM news WHERE name = ?"; my $sth = $dbh->prepare($sql) || die "$DBI::errstr"; $sth->execute($news) || die "$DBI::errstr";
2009-05-13T13:00:29 Monk88das Problem ist ja, das es bei mir (localhost mit mysql 5) mit diesem Code funktioniert.
QuoteAs of MySQL 5.0.7, placeholders can be used for the arguments of the LIMIT clause when using prepared statements. See Section 12.2.8, “SELECT Syntax”.